IAnimationFrame interface

The IAnimationFrame interface represents an image for an object type. Despite the name, this interface is also used if the plugin uses a single image, like Tiled Background does.

Note IAnimationFrame cannot be directly rendered. You must first create a texture from it.

Methods

GetObjectType()
Return the associated IObjectType interface.
GetWidth()
GetHeight()
Return the size of the image, in pixels.
GetCachedWebGLTexture()
Return an IWebGLTexture interface if the texture is already loaded, else null.
GetTexRect()
Return an SDK.Rect representing the texture co-ordinates of this image on the loaded texture. This can only be called if GetCachedWebGLTexture() returned a texture.
async LoadWebGLTexture()
Start asynchronously loading a texture for this image. This should only be used if GetCachedWebGLTexture() returned null. Returns a promise that resolves with a IWebGLTexture representing the loaded texture.
ReplaceBlobAndDecode(blob)
Replace the image content of the animation frame with the given blob. The blob will be decoded as an image and the previous content of the animation frame overwritten with the image content of the blob. This may also change the size of the frame. Returns a promise that resolves when the image content has been updated.
SetDuration(d)
GetDuration()
Set and get the individual frame duration. This is a multiplier, e.g. 1 for normal speed, 2 for twice as long, etc.
SetOriginX(x)
SetOriginY(y)
GetOriginX()
GetOriginY()
Set and get the origin for this image. The origin is specified in texture co-ordinates, i.e. from 0 to 1. The default is 0.5, indicating the middle of the image.
GetImagePoints()
Return an array of IImagePoint representing the image points added to the image.
AddImagePoint(name, x, y)
Add a new image point to the image with the specified name and position. As with the origin, image point positions are specified in texture co-ordinates, i.e. from 0 to 1. Returns an IImagePoint representing the added image point.
GetCollisionPoly()
Return the ICollisionPoly representing the image's collision polygon.
Delete()
Immediately deletes this frame from its animation without any confirmation prompt. This cannot be undone.
Addon SDK Manual 2024-02-15

On this page