sprite
draw.sprite()
Draws a sprite from an image divided into frames.
draw.sprite(image, [x, y, w, h], [x, y, w, h], rotation)
image
HTMLImageElement
Reference to a previously loaded image object (e.g., using draw.newImage
).
[x, y, w, h]
Array
Defines the spritesheet crop used for the sprite.
(x
, y
) is the top-left corner of the frame in the image.
(w
, h
) is the width and height of the frame.
[x, y, w, h]
Array
Defines position (x
, y
) and size (w
= width, h
= height) of the drawing on screen.
Rotation angle in degrees. Rotation is applied around the object's center.