Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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!