Two.ImageSequence

Extends: Two.Rectangle

A convenient package to display still or animated images organized as a series of still images.

Constructor

ArgumentDescription
srcA list of URLs or Two.Textures.
oxThe initial x position of the Two.ImageSequence.
oyThe initial y position of the Two.ImageSequence.
frameRateThe frame rate at which the images should playback at.

fromObject

Returns: Two.ImageSequence

ArgumentDescription
objObject notation of a Two.ImageSequence to create a new instance

Create a new Two.ImageSequence from an object notation of a Two.ImageSequence.

nota-bene

Works in conjunction with Two.ImageSequence.toObject

textures

A list of textures to be used as frames for animating the Two.ImageSequence.

frameRate

The number of frames to animate against per second.

index

The index of the current tile of the sprite to display. Defaults to 0.

copy

ArgumentDescription
imageSequenceThe reference Two.ImageSequence

Copy the properties of one Two.ImageSequence onto another.

play

ArgumentDescription
firstFrameThe index of the frame to start the animation with.
lastFrameThe index of the frame to end the animation with. Defaults to the last item in the Two.ImageSequence.textures.
onLastFrameOptional callback function to be triggered after playing the last frame. This fires multiple times when the image sequence is looped.

Initiate animation playback of a Two.ImageSequence.

stop

Halt animation playback of a Two.ImageSequence and set the current frame back to the first frame.

clone

Returns: Two.ImageSequence

ArgumentDescription
parentThe parent group or scene to add the clone to.

Create a new instance of Two.ImageSequence with the same properties of the current image sequence.

toObject

Returns: Object

Return a JSON compatible plain object that represents the path.

dispose

Returns: Two.ImageSequence

Release the image sequence's renderer resources and detach all events. This method stops any running animation, clears animation callbacks, unbinds textures collection events, and disposes individual textures (calling dispose() for thorough cleanup) while preserving the renderer type for potential re-attachment to a new renderer.