Developer documentation
Effects tools
4 tools. Every change a tool makes is one undo step in SpriteGrid.
list_effectsEffects SpriteGrid haslooks only
The effects that can be put on a layer (outline, drop shadow, glow, palette snap...): what each does and its settings, with their types, ranges and defaults. describe_document shows the effects each layer has.
Parameters
Nothing.
Returns
effectslist of objectsrequiredEvery effect, by category.
5 fields
idstringrequiredPass it as `effect` to
add_effect.namestringrequiredcategorystringrequireddescriptionstringrequiredsettingslist of objectsrequired7 fields
idstringrequiredIts id, the key in `settings`.
namestringrequiredtypestringrequiredinteger, number, boolean, color, pair ({ "x", "y" }), choice (one of options, by name), gradient (points) or palette (colors).
defaultanyrequiredWhat it is when the effect is added.
minnumberrequiredmaxnumberrequiredoptionslist of stringsrequiredA choice's options.
add_effectAdd an effect
Puts an effect on a layer, with the settings you give (the rest keep their defaults; a palette setting starts as the document's palette). Effects are applied in their list order. Returns its id. Check it with render_preview, which shows effects.
Parameters
effectstringrequiredWhich effect: its id from
list_effects, like "outline", or its name.layerstringWhich layer: its id, or its exact name (
describe_documentlists them). Leave it out for the layer selected in SpriteGrid.settingsobjectSettings by id (
list_effectshas each effect's): numbers, true/false, colors as "#RRGGBB", a choice by name, a pair as { "x": 1, "y": 1 }, a gradient as [{ "at": 0, "color": "#000000" }, { "at": 1, "color": "#ffffff" }], a palette as a list of colors. Example: { "thickness": 1, "color": "#282a36" }.enabledbooleanFalse to add it turned off.
indexintegerWhere in the layer's list: 0 is applied first. Leave it out to add it last.
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.
update_effectChange an effect
Changes an effect's settings, turns it on or off, or moves it in the layer's list — any of them, in one undo step. What you leave out stays as it is.
Parameters
effectstringrequiredWhich effect: its id (
describe_documentlists each layer's effects), or its kind, like "outline", if the layer has just one.layerstringThe layer it's on. Leave it out when effect is an id.
settingsobjectSettings by id (
list_effectshas each effect's): numbers, true/false, colors as "#RRGGBB", a choice by name, a pair as { "x": 1, "y": 1 }, a gradient as [{ "at": 0, "color": "#000000" }, { "at": 1, "color": "#ffffff" }], a palette as a list of colors. Example: { "thickness": 1, "color": "#282a36" }.enabledbooleanTrue to turn it on, false to turn it off.
indexintegerMove it to here in the layer's list: 0 is applied first.
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_effectRemove an effectdeletes
Takes an effect off its layer, with any animation of its settings. Undo brings it back.
Parameters
effectstringrequiredWhich effect: its id (
describe_documentlists each layer's effects), or its kind, like "outline", if the layer has just one.layerstringThe layer it's on. Leave it out when effect is an id.
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.