Recommended resources
The freely available resources this lesson will direct you to.
Hello! Welcome back.
In the last two lessons, we set up a complete creative coding environment. You used Claude to generate a project structure, and you learned how to use VS Code's Live Server to see a live preview of your work. Your digital stage is set, the lights are on, and the audience (you!) is waiting. Now, we need to design the actors and the set.
Today, we're shifting our focus back to your area of expertise: Figma. Our goal is to structure and name your Figma layers and groups to ensure a clean and logical SVG export. This is perhaps the single most important step in the entire design-to-animation workflow. Getting this right makes the coding and animation phase smooth and intuitive; getting it wrong leads to messy, unmanageable code.
Think of it as preparing a blueprint for a builder. A clear, well-labeled blueprint ensures the house is built correctly. For us, a well-structured Figma file ensures our SVG is "animation-ready."
From Figma Layers to SVG Code
When you export a design as an SVG, Figma translates your layers and groups into XML code. This is the magic we need to harness.
- A group in Figma becomes a
<g>tag in the SVG. This is a container element, like a<div>in HTML, that allows you to transform (move, scale, rotate) multiple elements together. - A layer name in Figma can become the
idattribute of an element in the SVG. Anidis a unique identifier that we can use in our CSS to target that specific element for animation.
This direct translation is the key: Good naming in Figma is not just for housekeeping; it's how you create hooks for your code.

Core Principles for Animation-Ready SVGs
To ensure a clean handoff from design to code, there are a few core principles to follow when preparing your Figma file.
1. Group Logically
Any elements that you intend to animate as a single unit should be grouped together. If a character's arm is going to wave, the hand, forearm, and upper arm should be in a group named something like arm. This is a practice you likely already use in your design work for organization; here, it also serves a critical functional purpose for animation.
2. Name Everything Meaningfully
This is the most crucial step. Every layer or group that you plan to animate must have a unique and descriptive name.
- Be Descriptive: Use names like
left-wheel,logo-text, orhero-characterinstead ofGroup 28orRectangle 15. - Be Code-Friendly: Use simple, lowercase names. Avoid spaces and special characters. Use hyphens (
-) or camelCase (leftWheel) for multi-word names. This will make them valid and easy-to-use CSS IDs.
The following video provides an excellent, concise overview of this process. It shows how to design a simple graphic, name the layers, and how those names become targetable IDs in the code.
Make Awesome SVG Animations with CSS // 7 Useful Techniques
This clip from the Fireship channel clearly demonstrates the fundamental link between Figma layer names and the final SVG code structure. Pay close attention to how he names his layers and why.
Watch from 03:00 to 05:30. Notice the advice to give custom names to layers you intend to animate and how he groups elements based on color, which is another powerful strategy for styling.
3. Simplify and Clean Your Vectors
Complex Figma files with many strokes, effects, and overlapping shapes can result in messy, inefficient SVG code. Here are a few best practices for cleaning up your vectors before export.
Exporting and Using SVG Icons in Production 2024 - Simple Thread
This article from Simple Thread, 'Exporting and Using SVG Icons in Production 2024', offers some professional-grade tips for prepping vectors. We'll focus on two key techniques: outlining strokes and grouping paths.
Please read the sections titled 'Outlining Strokes' and 'Grouping Paths'. The goal is to understand why these steps are important for creating scalable and efficient SVGs.
As the article points out:
- Outline Strokes: A stroke has a thickness (e.g.,
2px). When you scale the SVG up, the shape gets bigger, but the stroke might not scale proportionally, leading to an inconsistent look. Using Object > Outline Stroke (Cmd+Shift+OorCtrl+Shift+O) converts the stroke into a filled shape, ensuring it scales perfectly. - Flatten Shapes (Boolean Operations): If you have multiple shapes that form a single visual element (like the water drop icon in the article), using Boolean operations (Union, Subtract, etc.) to combine them into a single vector path creates a much simpler and smaller SVG file.
A Practical Walkthrough
Now let's see these principles applied to a more complex illustration. The next video shows the process of taking an existing vector illustration, cleaning it up, deleting unnecessary parts, and logically grouping and naming the elements for animation.
Learn To Build An SVG Animation With CSS
In this video from 'developedbyed', you'll see a real-world example of preparing a complex file. This reinforces the concepts of grouping and naming that we've just discussed.
Watch from 03:29 to 06:48. Focus on how he identifies the parts he wants to animate (the hat, the wheels), groups them, and gives them simple, lowercase names like 'hat' and 'left-wheel'.
As you saw, both videos highlight a critical export setting: "Include 'id' Attributes." Without this enabled, Figma will strip out your carefully crafted layer names, and your SVG will not have the ids needed for animation. We will cover the export process in detail in the next lesson, but it's essential to know why we're doing all this prep work.
Your Pre-Flight Checklist for Figma to SVG
Based on these best practices, here is a checklist you can use every time you prepare a Figma design for animation.
- [ ] Logical Grouping: Have you grouped all elements that need to move together?
- [ ] Meaningful Naming: Does every layer and group you plan to animate have a unique, descriptive, code-friendly (lowercase, no spaces) name?
- [ ] Text to Outlines: Have you converted all text elements to vector shapes? (Select text, right-click > Create Outlines). This prevents font rendering issues.
- [ ] Strokes to Outlines: Have you outlined all strokes to ensure they scale correctly? (Select shape,
Cmd+Shift+O). - [ ] Flatten Shapes: Have you used Boolean operations to combine paths where appropriate to simplify the geometry?
- [ ] Delete Unused Layers: Have you removed any hidden or unnecessary layers that would add bloat to the final SVG?
Following this checklist will save you immense time and frustration in the coding stage.
Key Takeaways
- The structure of your Figma file—specifically your groups and layer names—directly dictates the structure of the exported SVG code.
- Name every element you wish to animate with a unique, simple, lowercase
id. This is how you will "find" the element with CSS. - Group elements that will be animated together.
- Clean up your artwork by outlining strokes, converting text to paths, and flattening shapes to ensure a clean, efficient, and scalable SVG.
Next Up
You now know how to architect a Figma file specifically for animation. In our next lesson, we will put this knowledge into action. You will take a prepared Figma design, export it as an optimized SVG, and use Claude to write the initial HTML and CSS to place it statically on your webpage.