# Canvas

Your animation is a code window. That's perfect for a README.

But a post on LinkedIn, a slide or a short video needs a picture with a certain shape, and something behind the window.

That's what the **Canvas** tab is for. It frames your code for the place it's going.

## Choose a size

Go to the **Canvas** tab, and under **Size** click **1:1**.

You will see your code window on a square background:

![The Canvas tab with the 1:1 size selected, and the code window on an orange gradient in the preview](https://codeanimate.dev/img/docs/canvas-tab.png)

Choosing a size turned the canvas on, with the `Signal` background and some padding around the window. You will change both in a moment.

These are the sizes:

| Size | Good for |
|---|---|
| **Auto** | Fits the code. |
| **16:9** | YouTube, slides, X. |
| **1:1** | Instagram, X, LinkedIn. |
| **4:5** | Instagram and LinkedIn portrait posts. |
| **9:16** | Reels, Shorts, TikTok. |

> [!TIP]
> You don't have to remember this table. The editor shows the same hint under **Size** when you select one.

## Choose a background

Under **Background** there are eight to choose from:

* Six gradients: **Signal**, **Ember**, **Aurora**, **Lagoon**, **Dusk** and **Midnight**.
* Two solid colors: **Paper** and **Graphite**.

Hover over a swatch to see its name, and click it to use it.

The first swatch is **None**. It removes the canvas, and you are back to the code window on its own.

## Set the padding

**Padding** is the space between the window and the edge of the background, from 16 to 160 px.

> [!NOTE]
> **Padding** needs a background. While the background is **None**, the slider is turned off.

## Choose the export resolution

At the bottom of the tab is **Export resolution**:

* **Standard** is sharp on most screens.
* **4K** makes the long edge of the picture up to 3840 px, for large screens and 4K video. It's part of **Pro**.

It only matters when you [export a file](https://codeanimate.dev/docs/exporting.md). The preview looks the same.

> [!NOTE]
> A GIF is never wider or taller than 1920 px, even with **4K**. Above that size, GIF files get very heavy.

## The canvas goes everywhere

The canvas is part of your animation, so you will see it wherever the animation goes:

* In the files you export.
* In the embeds you put in a README or a docs page.
* In the preview that appears when you paste your link in a chat or a social post.

So a snippet looks the same in a README as it does in the editor.

This is the embed of the animation of this tutorial, with its square canvas:

<a href="https://codeanimate.dev/p/ksjnWxPryLMGLVOA43zWaQ?copy=1"><img src="https://codeanimate.dev/api/embed/ksjnWxPryLMGLVOA43zWaQ.svg" alt="users.py: on a square Signal canvas" width="440" /></a>

## Zoom the preview

A tall canvas, like **9:16**, may look small in the preview. You can zoom in.

The controls are in the corner of the preview:

![The zoom controls: zoom out, the current percentage, zoom in, and fit](https://codeanimate.dev/img/docs/preview-zoom.png)

* **−** and **+** zoom out and in, from 25% to 400%.
* The **percentage** is the real scale. Click it to reset the view.
* The **frame** button fits the whole animation in the preview.

You can also:

* Hold `⌘` (`Ctrl` on Windows and Linux) and scroll, or pinch on a trackpad, to zoom.
* Drag, or scroll, to move around.
* Double-click the empty space around your code to reset the view.

> [!NOTE]
> Zooming only changes what **you** see. An export is always full size, whatever the zoom of the preview.

## Recap

With **Canvas** you:

* Choose a **size** for the place your animation is going.
* Put a **background** behind the code window, and set the **padding** around it.
* Choose the **resolution** of the files you export.

Now your animation is ready to leave the editor. Next, you will [Export a File](https://codeanimate.dev/docs/exporting.md).
