Animation Puppeteer — CSS

Direct CSS animation: 24 levels of keyframes, transform and timing functions. A CSS animation game for mastering smooth, performant motion.

What you learn in this game

A CSS transition makes a change to a CSS property happen smoothly over a set duration, instead of all at once.

A timing function sets how fast the change goes along the way. ease-in starts slow, ease-out starts fast, linear keeps one speed.

A CSS transform changes an element's position, size or tilt without moving the layout around it. translate slides, rotate turns, scale resizes.

@keyframes write out a sequence of CSS changes that can be played, even over and over. animation-name joins an element to those keyframes.

The animation property has a few more parts: iteration-count (how many times), delay (the pause before it starts), fill-mode (where it is at the end) and direction (which way it plays).

What the levels ask

  1. When the cempala knocks, Rara's puppet changes the colour of its cloth at once. In Nenek's memory the cloth reddens slowly. Write a transition so the colour changes smoothly like that.
  2. This puppet grows when the cempala knocks: its width and height change together. Make both change smoothly with one transition, without writing each property out.
  3. The puppet walks right when the cempala knocks. This time write its transition in two parts: the property that transitions in transition-property, how long in transition-duration.
  4. This puppet jumps up when the cempala knocks. In Nenek's memory it waits a moment first, then rises. Write the whole transition, its pause included: see on the strip of beats when it sets off and when it arrives.
  5. The giant sets off to the right. In Nenek's memory he starts slow and gets faster. Set the duration and the timing function in the transition.
  6. The princess comes in from the left: fast at first, then slowing gently before she stops. Set her transition.
  7. This puppet glides right at the same speed from start to finish. Set its transition.
  8. The dancer steps right: slow at first, fast in the middle, slow again at the end. Set the transition.
  9. The transition is in the book already. Now write where the puppet goes when the cempala knocks: slide it right with transform.
  10. When the cempala knocks, the puppet bows in respect: it tilts. Write the transform that tilts it like Nenek's memory.
  11. Triwikrama: the puppet grows when it is angry. Write the transform that makes it bigger like Nenek's memory.
  12. The defeated knight steps forward, then falls. Write two transform functions in a row: their order decides where he ends up.

And more, 24 levels in all.