Protected ReadonlydataThe image data. Each byte contains two 4-bit color pixels.
Protected ReadonlyheightThe image height in pixels.
Protected ReadonlywidthThe image width in pixels.
Creates and returns an animation player for this animation. The actual drawing is done by the specified callback which is called for each frame and receives the image to render.
Callback to call on each frame update. This callback is responsible for actually showing the animation frame to the user.
The created animation player. You have to call the start() method on it to start the animation.
Draws the image onto the given rendering context.
The rendering context to draw the image to.
Optional horizontal target position. Defaults to 0.
Optional vertical target position. Defaults to 0.
Returns the RGBA color at the specified position.
The horizontal pixel position.
The vertical pixel position.
The RGBA color at the specified position.
RangeError if coordinates are outside of the image boundaries.
Returns a copy of the image data. Each byte contains two 4-bit color values.
The image data.
The image height in pixels.
Returns the animation update with the given index.
Animation update index.
The animation update.
RangeError if the index is out of bounds.
The number of animation updates.
The image width in pixels.
Resets the given canvas to the image size and fills the canvas with the image. This does not create a new canvas so any canvas implementation can be used and existing canvas objects can be re-used.
In a browser you do this:
const canvas = image.toCanvas(document.createElement("canvas"))`;
In Node.js (with node-canvas) you do this:
import { createCanvas} from "canvas";
const canvas = image.toCanvas(createCanvas());
The canvas to reset and fill.
The passed canvas for method chaining.
Copies the opaque pixels of this image into the given image data and returns the modified image data.
The image data to copy the opaque pixels of this image to.
The image data.
StaticfromParses a end animation from the given array and returns it.
The array containing the two encoded MSQ blocks with the base frame and animation data.
The parsed end animation.
Staticfrom
Contains the base frame of the ending animation but also provides methods to access the animation information. To simply play the animation it is recommended to use the EndingPlayer class.