Blocks · click one to add it to your code · ? explains it
New to JavaScript? Start here · All blocks, explained · Shape styles · Animation Reference
Animation settings: frames, fps, loop and t
Each animation in animations has these settings. More in the
Animation Reference (it opens in a new tab).
| Setting | What it does | Range | Example |
|---|---|---|---|
frames |
How many pictures the animation has. More frames move more smoothly. More | 1 to 64, whole | frames: 8 |
fps |
Frames per second: how fast the pictures change. The animation lasts frames ÷ fps seconds. More | above 0, up to 60 | fps: 10: 8 frames last 0.8 s |
loop |
true: starts again at the end (idle, walk, air). false: plays once and stops (jump, wave). Left out, it is true. More |
true or false |
loop: false |
draw(pen, t) |
Draws one picture. t is the time: 0 at the start, 1 at the end. Work out the pose from t. More |
t from 0 to 1 |
const bob = pen.wave(t, 2) * 2; |
The names the games play: idle (standing), walk, jump (once), wave (once, in the Test Lab) and air (in the air, in Quiz Climb). Any other name is yours to try: other names. When each plays. Next to the animations, trail is a small picture of its own that the games scatter behind a moving character.
Shape style: fill, line, ink, shade, shine, alpha, silhouette
Every shape ends with its style in { }, like pen.circle(0, -40, 20, { fill: '#ff8fab', line: 0 }).
Leave a setting out and it is as below. Pictures of each in the
Animation Reference (it opens in a new tab).
| Setting | What it does | Left out | Example |
|---|---|---|---|
fill |
The colour inside, as a #rrggbb code. |
no fill: only the outline | fill: '#ff8fab' |
line |
How thick the shape's own outline is. 0 for none. |
the character's line (3) |
line: 0 |
ink |
The colour of the outline (or of a line). | the character's ink (dark purple) |
ink: '#e63946' |
shade, shine |
A darker side away from the light, and a light spot facing it, so the shape looks round. They need a #rrggbb fill. |
off | shade: true |
alpha |
See-through: 0 is invisible, 1 is solid. | 1 | alpha: 0.5 |
corner |
Rectangles only: how round the corners are. | 0: square | corner: 8 |
silhouette |
false leaves the shape out of the character's thick outer outline. That outline (silhouette: 2 at the top of the
script) goes round the whole figure, even round shapes with line: 0. For no border at all, write both.
|
in the outline | { line: 0, silhouette: false } |
Scripts are programs. They run in a separate worker, away from this page and its saved drafts, but they can still use the network. Only open scripts from people you trust.