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 The Animation Challenge Solution

Elise St Hilaire
Elise St Hilaire
13,358 Points

Can't get animation to work

I'm not sure what I'm missing here, but the none of the animations from are working like they do in the video. Any help is much appreciated!

/* --------------------------
  Keyframes
--------------------------- */

@keyframes slide {
  0% {transform: translateY(0);}
  50% {transform: translateY(-10px);}
  80% {transform: translateY(10px);}
  100% {transform: translateY(0);}
}

@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: rotate(-5deg) scale(1.3),
        opacity: 1;
        fill: #ffff99;
  }
  100% {
    transform: scale(1);
}

@keyframes offset {
  60% {
    stroke-opacity: 1;
  }
  100% {
    stroke-dashoffset: 0;
  }
}

/* --------------------------
  SVG Styles
--------------------------- */
.star * {
  transform-origin: 50% 50%;

.star {
  transform: translateY(0, 200px, 0);
  animation: slide 0.5s forwards, 
    pulse 0.5s 2s ease-in-out;
}
/*

.star:before {
  animation-fill-mode:none;
}
*/

.star:nth-of-type(1) {
  animation-delay: 0.5s 1.8s;
}

.star:nth-of-type(2) {
  animation-delay: 0s 1.5s;
}

.star:nth-of-type(3) {
  animation-delay: 0.8s 1.8s;
}

.stars-bg {
  stroke-opacity: 0;;
  stroke-dashoffset: 815;
  stroke-dasharray: 815;
  animation: offset .8s 2.2s linear forwards;
}

.star:nth-of-type(3) {
  animation-delay: 0.7s;
}
Jun Zhang
Jun Zhang
10,785 Points

The last 3 lines of code seems to be overriding the previous code (nth-of-type(3)); try removing them.