Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?

ROLL20 TOKEN ANIMATOR

Names

Animation and scene names should match the following regular expression: ^[_0-9a-zA-Z]+$

Statements

Basic statement layout:

<command> [<start time> [<duration> [<...args>]]]

Comments can be declared using // ....

start time (S) -- The time at which the command should be run, in milis, from when the animation started.

duration (D) -- The duration over which the command should be run, relevant in cases where e.g. a move should be done smoothly over a long period.

args -- All movement values are in pixels, all rotation values are in degrees.

- -- A single dash ("-") represents an nonexistent value.

Move

Moves a token.

mv S D x y z

x -- Amount to move in the X direction.

y -- Amount to move in the Y direction.

z -- Amount to move in the Z direction; Z movement is marked by updating the "wings" status on a token.

Move Exact

Moves a token to an exact position (arguments as above).

mvx S D x y z

Copy

Duplicates a token. This can optionally trigger an animation on the newly-created child token.

cp S childAnimation

childAnimation -- Name of an animation to trigger on the child.

Rotate

Rotates a token.

rot S D degrees

degrees -- Amount to rotate.

Rotate Exact

Rotates a token to an exact angle (arguments as above).

rotx S D degrees

Flip

Flips a token.

flip S h v

h -- true if the token is to be flipped horizontally, false otherwise.

v -- true if the token is to be flipped vertically, false otherwise.

Flip Exact

Flips a token to an exact orientation (arguments as above).

flipx S h v

Scale

Scales a token. scale S D scaleX scaleY

scaleX -- scaling factor for the token to be scaled to in the X dimension; initial scale is "1.0" (double size would be "2.0").

scaleY -- scaling factor for the token to be scaled to in the Y dimension; initial scale is "1.0" (double size would be "2.0").

Scale Exact

Scales a token to an exact scale (arguments as above).

scalex S D scaleX scaleY

Layer

Change which layer the token is on.

layer S layerName

layerName -- One of {map, token, gm, foreground, lighting, weather}

Lighting

Change the token's lighting properties.

light S D lightRadius dimStart degrees

lightRadius -- Light radius, in feet.

dimStart -- Start of dim light, in feet.

degrees -- Light angle.

Lighting Exact

Change the token's lighting properties to exact values (arguments as above).

lightx S D lightRadius dimStart degrees

Set Property

Set a property on the token.

`prop S propName value`

propName -- The property name. See Appendix A for a list of valid properties. Note that the gmnotes and sides properties are automatically URL-escaped to match the format Roll20 expects.

value -- The property value. This is passed to JSON.parse() (assuming a string as a fallback in case of errors). Therefore, any valid JSON can be inserted into this field. Note that this argument can include spaces.

Trigger Macro

Trigger a macro.

macro S <macro name>

Trigger Animation

Trigger an animation. Note that this can be used to cause an animation to loop, by re-triggering the same animation after a set delay.

anim S <animation name>

Appendix A: Token Properties

The following are technically valid token properties, although may produce undesirable effects if changed. Use with caution.

left
top
width
height
z_index
imgsrc
rotation
type
layer
locked
flipv
fliph
anim_loop
anim_paused_at
anim_autoplay
name
gmnotes
controlledby
represents
bar1_value
bar1_max
bar1_link
bar2_value
bar2_max
bar2_link
bar3_value
bar3_max
bar3_link
aura1_radius
aura1_color
aura1_square
aura2_radius
aura2_color
aura2_square
tint_color
status_dead
statusmarkers
showname
showplayers_name
showplayers_bar1
showplayers_bar2
showplayers_bar3
showplayers_aura1
showplayers_aura2
playersedit_name
playersedit_bar1
playersedit_bar2
playersedit_bar3
playersedit_aura1
playersedit_aura2
light_radius
light_dimradius
light_otherplayers
light_hassight
light_angle
light_losangle
light_multiplier
adv_fow_view_distance
groupwith
sides
currentSide
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.