Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS Animating SVG with CSS Keyframe and Line Drawing Animations Finishing the Animation Sequence

Samuel Kleos
seal-mask
.a{fill-rule:evenodd;}techdegree
Samuel Kleos
Front End Web Development Techdegree Student 13,423 Points

Why aren't the keyframes happening at the same time?

I noticed the pulse animation happens after the other keyframe animations are complete.

Why do they happen in sequence? Is that standard behaviour or was it a property in a CSS rule included somewhere.

I think keyframes need to actually be explained, because I don't get what's actually going on here under the hood.

1 Answer

Steven Parker
Steven Parker
231,269 Points

The timers for the animations all start at once, but each animation has a duration and a delay setting that determine when it will begin and how long it will last:

.star {
  animation: turn 1.1s .2s ease-out backwards;
}

.star circle {
  animation: pulse .7s 1.5s;
}

So for these two animations, the "turn" begins when the timer reaches 0.2 seconds, and it will last for 1.1 seconds. That means it will be totally finished in 1.3 seconds. But the "pulse" doesn't begin until 1.5 seconds, so it will appear to be in sequence with the "turn".