Step Effects
Every step after the first one arrives with an effect.
There are 28. This page shows each one playing, and tells you how it works.
To choose one in the editor, see Effects, Focus and Timing.
The example
Every animation on this page shows the same change, so that you can compare them.
Step 1 is a function that adds up prices in a loop. Step 2 does the same in one line, and adds a tax.
The two steps, as text
Step 1:
def total(items):
result = 0
for item in items:
result += item.price
return result
Step 2:
def total(items, tax=0.2):
subtotal = sum(item.price for item in items)
return subtotal * (1 + tax)
The only thing that changes from one animation to the next is the effect of step 2.
How an effect works
When the animation goes from one step to the next, it compares the two versions of the code piece by piece: each word, name, number and symbol.
That gives three kinds of code:
- Kept: pieces that are in both steps. In the example,
def total(items,for item,priceandreturnare kept, even though some of them end up on another line. - Removed: pieces that are only in the old step, like
resultand+=. - New: pieces that are only in the new step, like
tax=0.2andsum(.
An effect is a rule for what each of the three does.
The effects come in four groups, the same four you see in the gallery in the editor:
| Group | What happens |
|---|---|
| Keep matching code | Kept code glides to its new place while the rest fades. |
| Bring in the new code | Kept code moves first. Then the new code makes an entrance. |
| Replace the block | All the old code leaves, and then all the new code arrives. |
| Slide | The old code slides out as the new code slides in. |
How long it takes
An effect takes the time you set in Transition, in the Motion tab.
Each step can also have its own Speed, from 0.25× to 2×. At 2× the effect takes half the time, and at 0.5× it takes twice as long.
No effect plays in less than 0.2 seconds.
In the animations on this page, the transition is 1.4 seconds, which is slower than the default. That gives you time to see what happens.
Tip
In each animation, step 1 is typed quickly, and rests for a moment. Then the effect plays, and the result rests before the loop starts again.
Click an animation to open its page. There you can also copy its code.
Keep matching code
These four are for a change where most of the code stays. The kept pieces glide to their new places through the whole transition, so your viewers can follow each one with their eyes.
Morph
The default.
The kept pieces glide from where they were to where they are now. The removed pieces fade out during the first half, and the new pieces fade in during the second.
Nothing else moves, so this is the calmest way to show a change.
Pulse
A morph, while the whole block swells and settles twice, like a heartbeat. The second beat is smaller than the first.
Use it to say something just changed here without taking the eyes off the code.
Shake
A morph, while the whole block rocks from side to side, a little less each time, until it's still.
Wobble
A morph, while the whole block gets wider and shorter, then taller and narrower, like jelly, and settles.
Bring in the new code
These ten are for a change where the new code is the point.
They all start the same way: in the first 40% of the transition, the kept pieces glide to their new places and the removed pieces clear away. The code that stays is then where it belongs, with gaps where the new code goes.
The rest of the transition is the entrance of the new code. That's where they differ.
Type
The new code is typed into the gaps, in reading order, with a cursor.
It looks like someone writing the change by hand, the same way step 1 is typed.
Materialize
The new pieces fade in right where they belong, a few at a time.
The order looks random, but it's the same every time the animation plays.
Rain
Like Materialize, a few pieces at a time. But each piece also falls into its place, from about a line and a half above.
Matrix
The new code rains down its columns, a letter at a time.
In each column the lowest letter leads and the others follow it, each one a little dimmer than the one ahead. The columns start at slightly different moments, and they all take the same time to fall, so a tall column falls faster.
The letters are green while they fall. When a column lands, its letters take their own colors.
Color matrix
The same rain as Matrix, with every letter falling in the color it will have, instead of green.
Cascade
The new lines slide in from the left, the top one first and then the others, one after another.
Rise
The new lines come up from one line below their place, one after another.
Weave
The new lines slide in from alternate sides: one from the left, the next from the right.
Sweep
The new code arrives from left to right. The pieces nearest the left edge come in first, whatever line they are on, like a curtain being drawn across the code.
Assemble
All the new pieces start scattered around their places, up to a few lines and columns away, and fly in together.
Replace the block
These ten don't look at what the two steps share. They treat the code as one picture: the old one leaves, and the new one arrives.
The code itself changes at the moment when nothing can be seen, so the swap is never visible.
Use them when the two steps have little in common, or when you want a clear break between them, like a new slide.
Fade
The old code fades out, and then the new code fades in. Nothing moves.
Zoom
The old code grows a little as it fades out. The new code starts a little small and grows into place.
Zoom out
Zoom, backwards. The old code shrinks a little as it fades out. The new code starts a little large and settles into place.
Pop
The old code shrinks away quickly. The new code springs up from small, goes a little past its full size, and settles.
Bounce
The old code drops down and away. The new code falls in from a line above, and bounces twice before it rests.
Slam
The old code clears quickly. The new code drops in from almost twice its size, faster and faster until it lands, and the block shakes once from the hit.
Flip
The block folds flat from the top and the bottom, like a card turning over. When it's edge-on, the code changes, and the block opens again on the new code.
Turn
The same as Flip, from the sides: like a page turning.
Twist
The old code turns a few degrees and shrinks a little as it fades. The new code turns into place from the other side.
Glitch
Nothing glides here. The block jumps sideways and dims in sudden steps, goes dark for an instant, and comes back as the new code, like a bad signal.
Slide
These four also replace the whole block. The old code slides out as it fades, and the new code slides in from the opposite side.
It's a short move: one line up or down, or three columns sideways.
From bottom
The old code slides up and out. The new code slides in from the bottom.
From top
The old code slides down and out. The new code slides in from the top.
From left
The old code slides out to the right. The new code slides in from the left.
From right
The old code slides out to the left. The new code slides in from the right.
Which one to use
There are no rules, but this can help you start:
| You want to show | Try |
|---|---|
| A small edit, where the eyes should follow the code that stays | Morph |
| New lines being added to code that stays | Type, Cascade or Rise |
| A value or a name that changes, with some emphasis | Pulse or Pop |
| A completely different piece of code | Fade, Flip or a Slide |
| The big moment of your talk | Slam, Glitch or Matrix |
Tip
You can use a different effect for each step. But an animation is easier to follow when most steps use the same one, and you keep the loud effects for the moment that matters.
Where the effects play
An effect plays the same way everywhere your animation goes:
- In the preview of the editor.
- In the GIF and MP4 files that you export.
- In the embeds that you share, both the animated SVG and the GIF.
Note
Matrix and Color matrix draw every falling letter on its own, which makes an embed bigger.
So if an animation adds a lot of code with these two effects (more than about 600 letters in total), the steps that go over rain whole words instead of single letters.
Recap
- An effect decides what the kept, the removed and the new code do when the animation goes from one step to the next.
- Keep matching code follows the code that stays. Bring in the new code gives the new code an entrance. Replace the block and Slide change everything at once.
- It takes the time of your Transition, changed by the Speed of the step.
In an API snapshot, an effect is the effect of a step. The values are listed there.