* Class: Gfx2SpriteJAS #author("2024-02-10T19:09:28+00:00","","") The `Gfx2SpriteJAS` is a subclass of `Gfx2Drawable` that represents a sprite with animations. - inherit from: Gfx2Drawable~ ** Constructors - ''new Gfx2SpriteJAS''(): Gfx2SpriteJAS~ The constructor.~ ** Methods - ''draw''(): void~ The "draw" function is responsible for rendering a visual representation on a 2DCanvas.~ ~ - ''getAnimations''()~ The "getAnimations" function returns an array of animation descriptors.~ ~ - ''getCurrentAnimation''()~ The "getCurrentAnimation" function returns the current animation or null if there is no current animation.~ ~ - ''getCurrentAnimationFrameIndex''(): number~ The "getCurrentAnimationFrameIndex" function returns the current animation frame index.~ ~ - ''getFlip''()~ The "getFlip" function returns two booleans, first is the x-axis flip flag, second is the y-axis flip flag.~ ~ - ''getOffset''(): vec2~ The "getOffset" function returns the origin offset.~ ~ - ''getOffsetX''(): number~ The "getOffsetX" function returns the offset in x-axis direction.~ ~ - ''getOffsetY''(): number~ The "getOffsetY" function returns the offset in y-axis direction.~ ~ - ''getOpacity''(): number~ The "getOpacity" function returns the opacity value.~ ~ - ''getPosition''(): vec2~ The "getPosition" function returns the position.~ ~ - ''getPositionX''(): number~ The "getPositionX" function returns the x-coordinate of the position.~ ~ - ''getPositionY''(): number~ The "getPositionY" function returns the y-coordinate of the position.~ ~ - ''getRotation''(): number~ The "getRotation" function returns the rotation.~ ~ - ''getScale''(): vec2~ The "getScale" function returns the scale as a 2D vector.~ ~ - ''getScaleX''(): number~ The "getScaleX" function returns the scale factor on x-axis.~ ~ - ''getScaleY''(): number~ The "getScaleY" function returns the scale factor on y-axis.~ ~ - ''getTexture''()~ The "getTexture" function returns the sprite texture.~ ~ - ''isVisible''(): boolean~ The "isVisible" function returns a boolean value indicating whether an element is visible or not.~ ~ - ''loadFromFile''(path: string): Promise~ The "loadFromFile" function asynchronously loads sprite data from a json file (jas).~ -- ''path'': The `path` parameter is the file path.~ ~ - ''paint''(): void~ The "paint" function is rendering the sprite.~ ~ - ''play''(animationName: string, looped: boolean, preventSameAnimation: boolean): void~ The "play" function is used to start playing a specific animation, with options for looping and preventing the same animation from being played again.~ -- ''animationName'': The name of the animation to be played.~ -- ''looped'': The `looped` parameter is a boolean that determines whether the animation should loop or not.~ -- ''preventSameAnimation'': The `preventSameAnimation` parameter is a boolean flag that determines whether the same animation should be prevented from playing again.~ ~ - ''rotate''(a: number): void~ The "rotate" function add rotation value to current angle.~ -- ''a'': The rotation angle to add in radians.~ ~ - ''setAnimations''(animations: JASAnimation[]): void~ The "setAnimations" function sets the animations property.~ -- ''animations'': The `animations` parameter is an array of animation descriptors.~ ~ - ''setFlipX''(x: boolean): void~ The "setFlipX" function sets the value of the flipX property to the provided boolean value.~ -- ''x'': The x-axis flip flag.~ ~ - ''setFlipY''(y: boolean): void~ The "setFlipY" function sets the value of the flipY property to the provided boolean value.~ -- ''y'': The y-axis flip flag.~ ~ - ''setOffset''(x: number, y: number): void~ The "setOffset" function set the origin offset value.~ -- ''x'': The x-offset.~ -- ''y'': The y-offset.~ ~ - ''setOpacity''(opacity: number): void~ The "opacity" function sets the opacity of an element.~ -- ''opacity'': The `opacity` value ranges from 0 to 1, where 0 represents completely transparent and 1 represents completely opaque.~ ~ - ''setPosition''(x: number, y: number): void~ The "setPosition" function set the position with the given x and y coordinates.~ -- ''x'': The X coordinate of the position.~ -- ''y'': The Y coordinate of the position.~ ~ - ''setRotation''(rotation: number): void~ The "setRotation" function sets the rotation angle (in radians).~ -- ''rotation'': The `rotation` parameter is the rotation angle in radians.~ ~ - ''setScale''(x: number, y: number): void~ The "setScale" function sets the scale with the given x and y factors.~ -- ''x'': The x factor in the x-axis direction.~ -- ''y'': The y factor in the y-axis direction.~ ~ - ''setTexture''(texture: ImageBitmap): void~ The "setTexture" function sets the sprite texture.~ -- ''texture'': The sprite texture.~ ~ - ''setVisible''(visible: boolean): void~ The "setVisible" function set the visibility.~ -- ''visible'': The "visible" parameter is a boolean value that determines whether an element should be visible or not.~ ~ - ''translate''(x: number, y: number): void~ The "translate" function translate the position.~ -- ''x'': The amount of translation in the x-axis direction.~ -- ''y'': The amount of translation in the y-axis direction.~ ~ - ''update''(ts: number): void~ The "update" function.~ -- ''ts'': The `ts` parameter stands for "timestep".~ ~ - ''zoom''(x: number, y: number): void~ The "zoom" function add scale values.~ -- ''x'': The x factor in the x-axis direction.~ -- ''y'': The y factor in the y-axis direction.~