Developer documentation
Animation tools
10 tools. Every change a tool makes is one undo step in SpriteGrid.
set_animationMake or change the animation
Makes the document an animation (24 frames at 12 per second unless you say), or changes its length and speed. Then give layers drawings per frame with set_cel, or move them with set_keyframe.
Parameters
frameCountintegerHow many frames, 1 to 9999.
frameRateintegerFrames per second, 1 to 60.
documentstringWhich document: its id from
get_status(like "doc-1"), its path, or its name. Leave it out for the one you're working on, or the one shown in SpriteGrid before you've worked on one.expectedRevisionintegerThe document's revision when you looked at it: if the document has changed since (the user edited it, say), nothing is done and you're told so.
Returns
documentstringrequiredThe document's id.
revisionintegerrequiredIts revision after the change.
summarystringrequiredWhat changed, in a line.
layerstringThe layer changed or made, if there was one.
changedobjectThe rectangle of pixels that changed, if any did.
4 fields
xintegerrequiredLeft edge, in pixels from the left of the canvas.
yintegerrequiredTop edge, in pixels from the top of the canvas.
widthintegerrequiredWidth in pixels.
heightintegerrequiredHeight in pixels.
pixelsChangedintegerHow many pixels changed.
slicestringThe slice changed or made, if there was one.
effectstringThe effect changed or added, if there was one.
tilestringThe tile changed or made, if there was one.
remove_animationRemove the animationdeletes
Takes the animation away: its frames, drawings and keys. Undo brings it all back.
Parameters
documentstringWhich document: its id from
get_status(like "doc-1"), its path, or its name. Leave it out for the one you're working on, or the one shown in SpriteGrid before you've worked on one.expectedRevisionintegerThe document's revision when you looked at it: if the document has changed since (the user edited it, say), nothing is done and you're told so.
Returns
documentstringrequiredThe document's id.
revisionintegerrequiredIts revision after the change.
summarystringrequiredWhat changed, in a line.
layerstringThe layer changed or made, if there was one.
changedobjectThe rectangle of pixels that changed, if any did.
4 fields
xintegerrequiredLeft edge, in pixels from the left of the canvas.
yintegerrequiredTop edge, in pixels from the top of the canvas.
widthintegerrequiredWidth in pixels.
heightintegerrequiredHeight in pixels.
pixelsChangedintegerHow many pixels changed.
slicestringThe slice changed or made, if there was one.
effectstringThe effect changed or added, if there was one.
tilestringThe tile changed or made, if there was one.
describe_animationDescribe the animationlooks only
The animation in detail: its length, speed and current frame; for each layer that changes over time, the frames where it has a drawing of its own (a letter per drawing, so shared drawings show) and its keyed values.
Parameters
documentstringWhich document: its id from
get_status(like "doc-1"), its path, or its name. Leave it out for the one you're working on, or the one shown in SpriteGrid before you've worked on one.
Returns
documentstringrequiredrevisionintegerrequiredframeCountintegerrequiredframeRateintegerrequiredFrames per second.
currentFrameintegerrequiredThe frame shown (from 0): the drawing tools draw on it.
playingbooleanrequiredautoKeybooleanrequiredTrue if drawing on a frame without its own drawing gives it one (SpriteGrid's Auto-Key). When false, such drawing is refused: use
set_celfirst.layerslist of objectsrequiredThe layers that change over time, top first.
4 fields
layerstringrequiredThe layer's id.
namestringrequiredcelslist of objectsrequiredIts drawings over time, or null if it shows one drawing on every frame.
3 fields
frameintegerrequiredThe frame it starts on. It shows until the next cel's frame.
drawingstringrequiredWhich drawing, as a letter: frames with the same letter share one drawing, so drawing on one changes them all.
emptybooleanrequiredTrue if the drawing is empty.
propertieslist of objectsrequiredIts animated values, or null.
3 fields
propertystringrequiredx, y (pixels it's moved by), rotation (degrees), scaleX, scaleY, opacity, visible, or an effect's setting.
effectstringrequiredThe effect whose setting it is (its id), or null.
keyslist of objectsrequired3 fields
frameintegerrequiredvalueanyrequiredA number, or true/false.
interpolationstringrequired"linear" (changes steadily to the next key), "hold" (stays until the next key) or "curve" (eased, set in SpriteGrid).
otherTrackslist of stringsrequiredOther animation (3D, camera) this doesn't show in detail, by name, or null.
go_to_frameGo to a frame
Shows a frame in SpriteGrid (pausing playback). The drawing tools draw on the frame shown unless you give them a frame. Not an undo step.
Parameters
frameintegerrequiredThe frame, from 0.
documentstringWhich document: its id from
get_status(like "doc-1"), its path, or its name. Leave it out for the one you're working on, or the one shown in SpriteGrid before you've worked on one.
Returns
documentstringrequiredThe document's id.
revisionintegerrequiredIts revision after the change.
summarystringrequiredWhat changed, in a line.
layerstringThe layer changed or made, if there was one.
changedobjectThe rectangle of pixels that changed, if any did.
4 fields
xintegerrequiredLeft edge, in pixels from the left of the canvas.
yintegerrequiredTop edge, in pixels from the top of the canvas.
widthintegerrequiredWidth in pixels.
heightintegerrequiredHeight in pixels.
pixelsChangedintegerHow many pixels changed.
slicestringThe slice changed or made, if there was one.
effectstringThe effect changed or added, if there was one.
tilestringThe tile changed or made, if there was one.
set_celGive a frame its own drawing
Gives an image layer its own drawing at a frame, so drawing there (a drawing tool with that frame) changes just that frame. It starts as a copy of what the layer shows there; or empty; or a copy of another frame's drawing (copyFrom); or, with linkTo, the very drawing another frame shows (drawing on either changes both). The first time, the layer's drawing stays on frame 0. Frames without their own drawing show the one before.
Parameters
frameintegerrequiredThe frame, from 0.
layerstringWhich layer: its id, or its exact name (
describe_documentlists them). Leave it out for the layer selected in SpriteGrid.emptybooleanTrue to start it empty.
copyFromintegerStart it as a copy of the drawing this frame shows.
linkTointegerShow the very drawing this frame shows (linked: not a copy).
documentstringWhich document: its id from
get_status(like "doc-1"), its path, or its name. Leave it out for the one you're working on, or the one shown in SpriteGrid before you've worked on one.expectedRevisionintegerThe document's revision when you looked at it: if the document has changed since (the user edited it, say), nothing is done and you're told so.
Returns
documentstringrequiredThe document's id.
revisionintegerrequiredIts revision after the change.
summarystringrequiredWhat changed, in a line.
layerstringThe layer changed or made, if there was one.
changedobjectThe rectangle of pixels that changed, if any did.
4 fields
xintegerrequiredLeft edge, in pixels from the left of the canvas.
yintegerrequiredTop edge, in pixels from the top of the canvas.
widthintegerrequiredWidth in pixels.
heightintegerrequiredHeight in pixels.
pixelsChangedintegerHow many pixels changed.
slicestringThe slice changed or made, if there was one.
effectstringThe effect changed or added, if there was one.
tilestringThe tile changed or made, if there was one.
delete_celDelete a frame's drawingdeletes
Takes a frame's own drawing away: it shows the drawing before it again. Undo brings it back.
Parameters
frameintegerrequiredThe frame, from 0.
layerstringWhich layer: its id, or its exact name (
describe_documentlists them). Leave it out for the layer selected in SpriteGrid.documentstringWhich document: its id from
get_status(like "doc-1"), its path, or its name. Leave it out for the one you're working on, or the one shown in SpriteGrid before you've worked on one.expectedRevisionintegerThe document's revision when you looked at it: if the document has changed since (the user edited it, say), nothing is done and you're told so.
Returns
documentstringrequiredThe document's id.
revisionintegerrequiredIts revision after the change.
summarystringrequiredWhat changed, in a line.
layerstringThe layer changed or made, if there was one.
changedobjectThe rectangle of pixels that changed, if any did.
4 fields
xintegerrequiredLeft edge, in pixels from the left of the canvas.
yintegerrequiredTop edge, in pixels from the top of the canvas.
widthintegerrequiredWidth in pixels.
heightintegerrequiredHeight in pixels.
pixelsChangedintegerHow many pixels changed.
slicestringThe slice changed or made, if there was one.
effectstringThe effect changed or added, if there was one.
tilestringThe tile changed or made, if there was one.
repeat_celsRepeat frames' drawings
Repeats a run of frames' drawings further on, linked (drawing on a repeat changes the frame it repeats), in one undo step: a walk cycle or a spinning wheel drawn once on frames 0–3 fills the whole animation with from 0 and to 3. From start, the frames show from's drawing, then from+1's and so on, times times over, or to the last frame.
Parameters
fromintegerrequiredThe first frame to repeat.
tointegerrequiredThe last frame to repeat.
startintegerWhere the repeats begin. Leave it out for the frame after to.
timesintegerHow many times over. Leave it out to fill to the last frame (the last repeat can be part of one).
layerstringWhich layer: its id, or its exact name (
describe_documentlists them). Leave it out for the layer selected in SpriteGrid.documentstringWhich document: its id from
get_status(like "doc-1"), its path, or its name. Leave it out for the one you're working on, or the one shown in SpriteGrid before you've worked on one.expectedRevisionintegerThe document's revision when you looked at it: if the document has changed since (the user edited it, say), nothing is done and you're told so.
Returns
documentstringrequiredThe document's id.
revisionintegerrequiredIts revision after the change.
summarystringrequiredWhat changed, in a line.
layerstringThe layer changed or made, if there was one.
changedobjectThe rectangle of pixels that changed, if any did.
4 fields
xintegerrequiredLeft edge, in pixels from the left of the canvas.
yintegerrequiredTop edge, in pixels from the top of the canvas.
widthintegerrequiredWidth in pixels.
heightintegerrequiredHeight in pixels.
pixelsChangedintegerHow many pixels changed.
slicestringThe slice changed or made, if there was one.
effectstringThe effect changed or added, if there was one.
tilestringThe tile changed or made, if there was one.
set_keyframeKey a value
Sets a layer's value at a frame, or at several in one undo step (keys): x or y (pixels it's moved by), rotation (degrees clockwise, around the layer's pivot), scaleX or scaleY (1 is its size, -1 mirrors), opacity (0 to 1), visible (true/false); or, with effect, a number or true/false setting of that effect. Between keys, numbers change steadily (linear) or stay until the next key (hold). Check it with render_frames.
Parameters
propertystringrequiredx, y, rotation, scaleX, scaleY, opacity or visible; with effect, the setting's id.
frameintegerThe frame, from 0, for one key (with value).
valueanyThe value at frame: a number, or true/false for visible and true/false settings.
keyslist of objectsSeveral keys at once, instead of frame and value: [{ "frame": 0, "value": 0 }, { "frame": 31, "value": 124, "interpolation": "hold" }].
3 fields
frameintegerrequiredThe frame, from 0.
valueanyrequiredA number, or true/false for visible and true/false settings.
interpolationstring"linear" or "hold". Leave it out for the call's interpolation.
layerstringWhich layer: its id, or its exact name (
describe_documentlists them). Leave it out for the layer selected in SpriteGrid.effectstringAn effect on the layer (its id, or its kind like "glow") whose setting to key.
interpolationstring"linear" (the default for a new key) or "hold", for every key that doesn't say. Leave it out to keep a key's.
documentstringWhich document: its id from
get_status(like "doc-1"), its path, or its name. Leave it out for the one you're working on, or the one shown in SpriteGrid before you've worked on one.expectedRevisionintegerThe document's revision when you looked at it: if the document has changed since (the user edited it, say), nothing is done and you're told so.
Returns
documentstringrequiredThe document's id.
revisionintegerrequiredIts revision after the change.
summarystringrequiredWhat changed, in a line.
layerstringThe layer changed or made, if there was one.
changedobjectThe rectangle of pixels that changed, if any did.
4 fields
xintegerrequiredLeft edge, in pixels from the left of the canvas.
yintegerrequiredTop edge, in pixels from the top of the canvas.
widthintegerrequiredWidth in pixels.
heightintegerrequiredHeight in pixels.
pixelsChangedintegerHow many pixels changed.
slicestringThe slice changed or made, if there was one.
effectstringThe effect changed or added, if there was one.
tilestringThe tile changed or made, if there was one.
delete_keyframeDelete a keydeletes
Takes a key away: the value there comes from the keys around it again. Undo brings it back.
Parameters
frameintegerrequiredThe frame, from 0.
propertystringrequiredx, y, rotation, scaleX, scaleY, opacity or visible; with effect, the setting's id.
layerstringWhich layer: its id, or its exact name (
describe_documentlists them). Leave it out for the layer selected in SpriteGrid.effectstringThe effect whose setting it is (its id or kind).
documentstringWhich document: its id from
get_status(like "doc-1"), its path, or its name. Leave it out for the one you're working on, or the one shown in SpriteGrid before you've worked on one.expectedRevisionintegerThe document's revision when you looked at it: if the document has changed since (the user edited it, say), nothing is done and you're told so.
Returns
documentstringrequiredThe document's id.
revisionintegerrequiredIts revision after the change.
summarystringrequiredWhat changed, in a line.
layerstringThe layer changed or made, if there was one.
changedobjectThe rectangle of pixels that changed, if any did.
4 fields
xintegerrequiredLeft edge, in pixels from the left of the canvas.
yintegerrequiredTop edge, in pixels from the top of the canvas.
widthintegerrequiredWidth in pixels.
heightintegerrequiredHeight in pixels.
pixelsChangedintegerHow many pixels changed.
slicestringThe slice changed or made, if there was one.
effectstringThe effect changed or added, if there was one.
tilestringThe tile changed or made, if there was one.
render_framesSee the animationlooks only
The animation's frames side by side in one image (left to right, then down), each scaled up over a checkerboard: the whole picture (with effects and movement) or one layer. At most 64 frames at a time.
Parameters
documentstringWhich document: its id from
get_status(like "doc-1"), its path, or its name. Leave it out for the one you're working on, or the one shown in SpriteGrid before you've worked on one.layerstringShow just this layer (id or exact name). Leave it out for the whole picture.
fromintegerThe first frame. Leave it out for 0.
tointegerThe last frame. Leave it out for the last one.
scaleintegerHow many screen pixels each document pixel becomes. Leave it out to fit about 1024 pixels.
columnsintegerFrames per row. Leave it out for about square.