What you'll build
A "check" icon that draws itself when it appears, and a bell icon that wiggles on hover. Both use plain CSS, so they work in any framework and cost zero JavaScript.
Step 1: Prepare the SVG
Give each part you want to animate a class. Keep the viewBox, and remove fixed width/height so CSS controls the size.
<svg class="icon-check" viewBox="0 0 24 24" fill="none" aria-hidden="true">
<path class="icon-check__path" d="M4 12.5l5 5L20 6.5"
stroke="currentColor" stroke-width="2.5"
stroke-linecap="round" stroke-linejoin="round" />
</svg>Step 2: Prompt Claude
Be specific about the motion, the duration and the limits. Ask for CSS only.
Here is an SVG (below). Write CSS only, no JavaScript, that:
1. Draws .icon-check__path from start to end in 600ms with ease-out, once, on load.
2. Uses stroke-dasharray / stroke-dashoffset.
3. Disables the animation inside @media (prefers-reduced-motion: reduce).
Return one CSS block and a one-line explanation of each property.
<svg>...paste your SVG...</svg>Step 3: Check the result
A good answer looks roughly like this:
.icon-check__path {
stroke-dasharray: 24;
stroke-dashoffset: 24;
animation: draw 600ms ease-out forwards;
}
@keyframes draw {
to { stroke-dashoffset: 0; }
}
@media (prefers-reduced-motion: reduce) {
.icon-check__path { animation: none; stroke-dashoffset: 0; }
}The 24 is the path length. If the line jumps or stops early, measure the real length in the browser console with document.querySelector('.icon-check__path').getTotalLength() and use that number.
Step 4: A hover wiggle
| Effect | Property to animate | Typical duration |
|---|---|---|
| Draw-in | stroke-dashoffset | 400–800ms |
| Wiggle | transform: rotate() | 300–500ms |
| Pulse | transform: scale() + opacity | 1–2s, infinite |
Ask Claude for the bell wiggle the same way. Name the trigger (:hover), the property and the duration.
Gotchas
- Animate
transformandopacitywhere you can. They are cheap for the browser; animatingwidthortopis not. - Set
transform-originfor rotations, or the icon spins around its corner. - Always keep the reduced-motion rule. Some people get dizzy from motion.
FAQ
Do I need an animation library for this?
No. For simple icon motion, CSS keyframes are enough and add no JavaScript.
Which Claude model should I use?
Any current Claude model can write this kind of CSS. Use the cheapest one that gives correct output for your icon.