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

Rami Awar
Rami Awar
5,435 Points

My animation, right after creating the slideup, isn't working. [SOLVED]

Right after the slideup, the stars seem to be going back to the position i specified at first by the "translateY(400%)" and ignoring the "forwards" fill-mode property of the animation. Here's the code. Thanks in advance!

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

@keyframes slideup{

  50%{
    transform: translateY(-10%);
  }
  80%{
    transform: translateY(10%);
  }
  100%{
    transform: translateY(0%);
  }
}

@keyframes pulse{

  50%{
    transform: rotate(5deg);
  }

}




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

.star{
  transform: translateY(400%);
  animation: slideup .6s forwards, 
              pulse .3s ease-out forwards;

}

/*

.middle{
  animation-delay: .4s, 1s;
}

.right{
  animation-delay: .8s, 1.6s;
}
*/

EDIT: It worked fine after assigning transform values to 0% and 100%, but why doesn't it work without them?

1 Answer

Erwin Meesters
Erwin Meesters
15,088 Points

Valid keyframe lists: In order for a keyframe list to be valid, it must include rules for at least the times 0% (or from) and 100% (or to) (that is, the starting and ending states of the animation). If both of these time offsets aren't specified, the keyframe declaration is invalid and can't be used for animation.

Rami Awar
Rami Awar
5,435 Points

Awesome man thanks!