UNPKG

starling-framework

Version:

A fast, productive library for 2D cross-platform development.

141 lines 4.56 kB
import Texture from "../textures/Texture"; import Image from "./Image"; import IAnimatable from "../animation/IAnimatable"; import SoundTransform from "openfl/media/SoundTransform"; import Sound from "openfl/media/Sound"; import Vector from "openfl/Vector"; declare namespace starling.display { /** * Dispatched whenever the movie has displayed its last frame. */ export class MovieClip extends Image implements IAnimatable { /** * Creates a movie clip from the provided textures and with the specified default framerate. * * The movie will have the size of the first frame. */ constructor(textures: Vector<Texture>, fps?: number); /** * Adds an additional frame, optionally with a sound and a custom duration. If the * * duration is omitted, the default framerate is used (as specified in the constructor). */ addFrame(texture: Texture, sound?: Sound, duration?: number): void; /** * Adds a frame at a certain index, optionally with a sound and a custom duration. */ addFrameAt(frameID: number, texture: Texture, sound?: Sound, duration?: number): void; /** * Removes the frame at a certain ID. The successors will move down. */ removeFrameAt(frameID: number): void; /** * Returns the texture of a certain frame. */ getFrameTexture(frameID: number): Texture; /** * Sets the texture of a certain frame. */ setFrameTexture(frameID: number, texture: Texture): void; /** * Returns the sound of a certain frame. */ getFrameSound(frameID: number): Sound; /** * Sets the sound of a certain frame. The sound will be played whenever the frame * * is displayed. */ setFrameSound(frameID: number, sound: Sound): void; /** * Returns the method that is executed at a certain frame. */ getFrameAction(frameID: number): Function; /** * Sets an action that will be executed whenever a certain frame is reached. * * * * @param frameID The frame at which the action will be executed. * * @param action A callback with two optional parameters: * * <code>function(movie:MovieClip, frameID:int):void;</code> * */ setFrameAction(frameID: number, action: Function): void; /** * Returns the duration of a certain frame (in seconds). */ getFrameDuration(frameID: number): number; /** * Sets the duration of a certain frame (in seconds). */ setFrameDuration(frameID: number, duration: number): void; /** * Reverses the order of all frames, making the clip run from end to start. * * Makes sure that the currently visible frame stays the same. */ reverseFrames(): void; /** * Starts playback. Beware that the clip has to be added to a juggler, too! */ play(): void; /** * Pauses playback. */ pause(): void; /** * Stops playback, resetting "currentFrame" to zero. */ stop(): void; /** * @inheritDoc */ advanceTime(passedTime: number): void; /** * The total number of frames. */ get numFrames(): number; /** * The total duration of the clip in seconds. */ get totalTime(): number; /** * The time that has passed since the clip was started (each loop starts at zero). */ get currentTime(): number; set currentTime(value: number) /** * Indicates if the clip should loop. @default true */ get loop(): boolean; set loop(value: boolean) /** * If enabled, no new sounds will be started during playback. Sounds that are already * * playing are not affected. */ get muted(): boolean; set muted(value: boolean) /** * The SoundTransform object used for playback of all frame sounds. @default null */ get soundTransform(): SoundTransform; set soundTransform(value: SoundTransform) /** * The index of the frame that is currently displayed. */ get currentFrame(): number; set currentFrame(value: number) /** * The default number of frames per second. Individual frames can have different * * durations. If you change the fps, the durations of all frames will be scaled * * relatively to the previous value. */ get fps(): number; set fps(value: number) /** * Indicates if the clip is still playing. Returns <code>false</code> when the end * * is reached. */ get isPlaying(): boolean; /** * Indicates if a (non-looping) movie has come to its end. */ get isComplete(): boolean; } } export default starling.display.MovieClip;