# Effects, Focus and Timing

In [Steps](https://codeanimate.dev/docs/steps.md) you made your code morph from one version to the next.

Now you will choose **how** each step arrives, point at the lines that matter, and set how long everything takes.

## Choose an effect

Every step after the first one has an **Effect**: the way the animation arrives at it.

Select step 3 and click the **Effect** button. It says `Morph`, because that's the default.

You will see the gallery:

![The effect gallery, with every effect playing in miniature, in groups](https://codeanimate.dev/img/docs/effects-gallery.png)

Every effect plays there in miniature, so you can see what it does before you choose it.

Click **Type**.

The preview plays that step once, with the new effect, on your own code. And the button now shows your choice:

![Step 3 with the Type effect selected](https://codeanimate.dev/img/docs/effects-chosen.png)

> [!TIP]
> You can mix effects. Each step keeps its own.

## The effects

There are 28, in four groups:

| Group | What happens | Effects |
|---|---|---|
| **Keep matching code** | Code that both steps share glides to its new place. | Morph, Pulse, Shake, Wobble |
| **Bring in the new code** | The code that stays moves into place first. Then the new code arrives. | Type, Materialize, Rain, Matrix, Color matrix, Cascade, Rise, Weave, Sweep, Assemble |
| **Replace the block** | All the old code leaves, and then the new code arrives. | Fade, Zoom, Zoom out, Pop, Bounce, Slam, Flip, Turn, Twist, Glitch |
| **Slide** | The old code slides out as the new code slides in. | From bottom, From top, From left, From right |

You can see every one of them playing, with how it works, in [Step Effects](https://codeanimate.dev/docs/step-effects.md).

> [!NOTE]
> **Matrix** and **Color matrix** look best when you give them time. Slow the step down with its **Speed**, or give the whole animation a longer **Transition**. You will see both below.

## Set a step's speed

Under the **Effect** button there's a **Speed** slider.

It makes that one step's effect slower or faster, from `0.25×` to `2×`. Next to it you can see how long the effect then takes, for example `1.5× · 0.53 s`.

When you let go of the slider, the step plays once at its new speed.

To go back, click **1×**.

> [!NOTE]
> No effect plays in less than 0.2 seconds. So if your **Transition** is already short, the faster speeds may change nothing.

## Focus on the lines that matter

In step 2 you changed two lines. Let's point at them.

Select step 2, and in **Focus lines** write:

```
6-7
```

Those two lines stay bright, and the rest dim:

![Step 2 with lines 6 and 7 in focus and the other lines dimmed](https://codeanimate.dev/img/docs/effects-focus.png)

The focus lasts while that step is on screen.

You can write single lines and ranges, separated by commas, like `3-5, 8`.

> [!TIP]
> You can also click the lines in the preview to add or remove them from the focus. That works while the animation is paused on the step you are editing.

To remove the focus, click the **✕** at the end of the field.

## Set the timing

Go to the **Motion** tab.

Now that your animation has steps, there are two more sliders:

![The Motion tab with Typing speed, End pause, Step hold, Transition and Loop length](https://codeanimate.dev/img/docs/motion-tab.png)

* **Step hold** is how long each step rests before the next one arrives.
* **Transition** is how long a step's effect takes, at `1×` speed.

Below them, **Loop length** shows how long the whole animation takes.

> [!WARNING]
> Anything you share as a link or an embed has to loop in **60 seconds or less**.
>
> If your animation is longer, **Loop length** turns red and tells you. You can still export it as a file.

## Recap

Now your animation does much more than type:

* Each step arrives with the **effect** you chose for it, at its own **speed**.
* **Focus lines** tell your viewers where to look.
* **Step hold** and **Transition** set the rhythm.

This is the animation of this tutorial now, with the focus on step 2 and the **Type** effect on step 3:

[![users.py: focus on step 2, the Type effect on step 3](https://codeanimate.dev/api/embed/DXn8BXoLMCXli55ZPsYapQ.svg)](https://codeanimate.dev/p/DXn8BXoLMCXli55ZPsYapQ?copy=1)

Whatever you choose plays the same way in the editor, in the files you export and in the embeds you share.

Next, you will frame your code for the place it's going, with [Canvas](https://codeanimate.dev/docs/canvas.md).
