Sprite script interface
ISpriteInstance interface derives from IWorldInstance to add APIs specific to the Sprite plugin.
See instance event for standard instance event object properties.
- Fired when the currently displayed animation frame changes during playback of an animation. The event object has the additional properties:
animationName: a string of the name of the currently playing animation
animationFrame: a zero-based index with the animation frame number of the new frame in its animation
- Fired when playback of the current animation reaches the end. The event object has the additional properties:
animationName: a string of the name of the animation that finished
- A reference to a IAnimation script interface representing the current animation, which can be used to access additional details such as the frames in the animation.
- setAnimation(name, from = "beginning")
- Set the current animation by a string of its name (case-insensitive).
from can be set to either
"current-frame" to switch to the same frame index in the new animation, or
"beginning" to rewind to the first frame.
- Get an IAnimation for an animation in the Sprite object by a case-insensitive string of its name. Returns
null if no animation is found.
- A read-only string of the current animation name. Use the
setAnimation() method to change the animation.
- startAnimation(from = "current-frame")
- Start playback of the current animation.
from can be set to either
"current-frame" to play from the existing frame, or
"beginning" to play from the first frame.
- Stop playback of the current animation.
- The zero-based index of the current animation frame.
- The current animation playback speed, in animation frames per second.
- The zero-based index of the animation frame to rewind to when repeating an animation.
- Read-only numbers indicating the size of the current animation frame's source image, in pixels.
- Return the number of image points on the current animation frame.
- Return the location of an image point on the current animation frame in layout co-ordinates. Image points are identified either by a case-insensitive string of their name, or their index. Note image point 0 is the origin, so index 1 is the first image point. If the image point is not found, this returns the origin instead. The
getImagePoint variant returns
- Return the number of collision polygon points on the current animation frame.
- Return the location of a collision polygon point on the current animation frame in layout co-ordinates, by its zero-based index. The
getPolyPoint variant returns
Construct 3 Manual
You are here:
Search this manual:
This manual entry was last updated on 28 Feb, 2022 at 17:40