TiledAnimation
Hierarchy
- Animation
- TiledAnimation
Index
Constructors
Properties
Accessors
Methods
Constructors
constructor
Parameters
options: GraphicOptions & Omit<AnimationOptions, frames> & TiledAnimationOptions
Returns TiledAnimation
Properties
publicinheriteddata
publicinheritedevents
publicinheritedframeDuration
publicinheritedframes
readonlyinheritedid
publicinheritedopacity
Gets or sets the opacity of the graphic, 0 is transparent, 1 is solid (opaque).
publicready
publicinheritedshouldAlwaysTick
Optional property to tick any graphics EVEN when offscreen, this is useful when you want to keep animations synchronized across your game scene.
publicinheritedshowDebug
Gets or sets wether to show debug information about the graphic
publicinheritedstrategy
publicoptionalinheritedtint
publicinheritedtransform
Accessors
publicinheritedcanFinish
Returns
trueif the animation can endReturns boolean
publicinheritedcurrentFrame
Returns the current Frame of the animation
Use Animation.currentFrameIndex to get the frame number and Animation.goToFrame to set the current frame index
Returns Frame | null
publicinheritedcurrentFrameIndex
Returns the current frame index of the animation
Use Animation.currentFrame to grab the current Frame object
Returns number
publicinheritedcurrentFrameTimeLeft
Returns the amount of time in milliseconds left in the current frame
Returns number
publicinheriteddirection
Returns the current play direction of the animation
Returns AnimationDirection
publicinheriteddone
Returns
trueif the animation is done, for looping type animationsex.AnimationStrategy.PingPongandex.AnimationStrategy.Loopthis will always returnfalseSee the
ex.Animation.canFinish()method to know if an animation type can endReturns boolean
publicinheritedflipHorizontal
Gets or sets the flipHorizontal, which will flip the graphic horizontally (across the y axis)
Returns boolean
Parameters
value: boolean
Returns void
publicinheritedflipVertical
Gets or sets the flipVertical, which will flip the graphic vertically (across the x axis)
Returns boolean
Parameters
value: boolean
Returns void
height
Gets or sets the height of the graphic (always positive)
Returns number
Parameters
height: number
Returns void
publicinheritedisPlaying
Returns
trueif the animation is playingReturns boolean
publicinheritedisReversed
Returns boolean
publicinheritedlocalBounds
Gets a copy of the bounds in pixels occupied by the graphic on the the screen. This includes scale.
Returns BoundingBox
publicinheritedorigin
publicinheritedrotation
Gets or sets the rotation of the graphic
Returns number
Parameters
value: number
Returns void
publicinheritedscale
sourceView
Returns Partial<SourceView>
Parameters
sourceView: Partial<SourceView>
Returns void
publicinheritedspeed
Current animation speed
1 meaning normal 1x speed. 2 meaning 2x speed and so on.
Returns number
Current animation speed
1 meaning normal 1x speed. 2 meaning 2x speed and so on.
Parameters
val: number
Returns void
width
Gets or sets the width of the graphic (always positive)
Returns number
Parameters
width: number
Returns void
Methods
publicinheritedclone
Returns a new instance of the graphic that has the same properties
Type parameters
- T: typeof Animation
Returns InstanceType<T>
publicinheritedcloneGraphicOptions
Returns GraphicOptions
publicinheriteddraw
Draw the whole graphic to the context including transform
Parameters
ex: ExcaliburGraphicsContext
The excalibur graphics context
x: number
y: number
Returns void
publicinheritedgoToFrame
Jump the animation immediately to a specific frame if it exists
Optionally specify an override for the duration of the frame, useful for keeping multiple animations in sync with one another.
Parameters
frameNumber: number
optionalduration: number
Returns void
publicinheritedisStale
Returns boolean
publicinheritedpause
Pauses the animation on the current frame
Returns void
publicinheritedplay
Plays or resumes the animation from the current frame
Returns void
publicinheritedreset
Reset the animation back to the beginning, including if the animation were done
Returns void
publicinheritedreverse
Reverses the play direction of the Animation, this preserves the current frame
Returns void
publicinheritedtick
Called internally by Excalibur to update the state of the animation potential update the current frame
Parameters
elapsed: number
Milliseconds elapsed
idempotencyToken: number = 0
Prevents double ticking in a frame by passing a unique token to the frame
Returns void
publicstaticfromAnimation
Parameters
animation: Animation
optionaloptions: Omit<TiledAnimationOptions, animation>
Returns TiledAnimation
publicstaticinheritedfromSpriteSheet
Create an Animation from a SpriteSheet, a list of indices into the sprite sheet, a duration per frame and optional AnimationStrategy
Example:
const spriteSheet = SpriteSheet.fromImageSource({...}); const anim = Animation.fromSpriteSheet(spriteSheet, range(0, 5), 200, AnimationStrategy.Loop);Type parameters
- T: typeof Animation
Parameters
this: T
spriteSheet: SpriteSheet
ex.SpriteSheet
spriteSheetIndex: number[]
0 based index from left to right, top down (row major order) of the ex.SpriteSheet
durationPerFrame: number
duration per frame in milliseconds
strategy: AnimationStrategy = AnimationStrategy.Loop
Optional strategy, default AnimationStrategy.Loop
optionaldata: Record<string, any>
Returns InstanceType<T>
publicstaticinheritedfromSpriteSheetCoordinates
Create an Animation from a SpriteSheet given a list of coordinates
Example:
const spriteSheet = SpriteSheet.fromImageSource({...}); const anim = Animation.fromSpriteSheetCoordinates({ spriteSheet, frameCoordinates: [ {x: 0, y: 5, duration: 100, options { flipHorizontal: true }}, {x: 1, y: 5, duration: 200}, {x: 2, y: 5}, {x: 3, y: 5} ], strategy: AnimationStrategy.PingPong });Type parameters
- T: typeof Animation
Parameters
this: T
options: FromSpriteSheetOptions
Returns InstanceType<T>
Animation
Create an Animation given a list of
framesin AnimationOptionsTo create an Animation from a SpriteSheet, use Animation.fromSpriteSheet