Readonly
idGets or sets the opacity of the graphic, 0 is transparent, 1 is solid (opaque).
Gets or sets wether to show debug information about the graphic
Returns true
if the animation can end
Returns the current frame index of the animation
Returns the current play direction of the animation
Returns true
if the animation is done, for looping type animations
ex.AnimationStrategy.PingPong
and ex.AnimationStrategy.Loop
this will always return false
See the ex.Animation.canFinish()
method to know if an animation type can end
Gets or sets the flipHorizontal, which will flip the graphic horizontally (across the y axis)
Gets or sets the flipVertical, which will flip the graphic vertically (across the x axis)
Gets or sets the height of the graphic (always positive)
Returns true
if the animation is playing
Gets a copy of the bounds in pixels occupied by the graphic on the the screen. This includes scale.
Gets or sets the rotation of the graphic
Gets or sets the width of the graphic (always positive)
Protected
_drawMeant to be overridden by the graphic implementation to draw the underlying image (HTMLCanvasElement or HTMLImageElement) to the graphics context without transform. Transformations like position, rotation, and scale are handled by Graphic._preDraw and Graphic._postDraw
The excalibur graphics context
Protected
_flipProtected
_postApply any additional work after Graphic._drawImage and restore the context state.
Protected
_preApply affine transformations to the graphics context to manipulate the graphic before Graphic._drawImage
Protected
_rotateDraw the whole graphic to the context including transform
The excalibur graphics context
Called internally by Excalibur to update the state of the animation potential update the current frame
Milliseconds elapsed
Prevents double ticking in a frame by passing a unique token to the frame
Static
fromCreate 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);
Create an Animation given a list of frames in AnimationOptions
To create an Animation from a SpriteSheet, use Animation.fromSpriteSheet