Blog

Inspiration, works in progress, and design and art talk.

simurai:

Sprite sheet animation with steps().
If you don’t wanna use gifs on your site and rather PNGs for better colors, but still be able to animate them, here an option:
CSS keyframe animations have a property called animation-timing-function and one of the options is to use the steps() feature like in this example:
div {
    animation: play 1s steps(10) infinite;
}
@keyframes play { 
      0% { background-position:    0px 0; } 
    100% { background-position: -500px 0; }
}

The difference to the other easing options is that instead of continuously moving from 0px to -500px, it jumps in steps with pauses in between. This is perfect for animations using a sprite sheet. In the above example it’s steps of 50px with a pause of 100ms (10 steps in total).
Here a little demo.
As you saw, you can change the speed how fast the animation should play, which is pretty cool, the only problem is that it always starts from the beginning and makes it look jumpy. I also tried to animate the animation-duration by using inherit from a parent element, but unfortunately that is not supported. So I guess if you wanna have a more dynamic speed (animating the animation), you still need to use JS for that.
ps. Here an example found in the wild: The logo of Impending.

I’m doing this! Now what to animate…

simurai:

Sprite sheet animation with steps().

If you don’t wanna use gifs on your site and rather PNGs for better colors, but still be able to animate them, here an option:

CSS keyframe animations have a property called animation-timing-function and one of the options is to use the steps() feature like in this example:

div {
    animation: play 1s steps(10) infinite;
}
@keyframes play { 
      0% { background-position:    0px 0; } 
    100% { background-position: -500px 0; }
}

The difference to the other easing options is that instead of continuously moving from 0px to -500px, it jumps in steps with pauses in between. This is perfect for animations using a sprite sheet. In the above example it’s steps of 50px with a pause of 100ms (10 steps in total).

Here a little demo.

As you saw, you can change the speed how fast the animation should play, which is pretty cool, the only problem is that it always starts from the beginning and makes it look jumpy. I also tried to animate the animation-duration by using inherit from a parent element, but unfortunately that is not supported. So I guess if you wanna have a more dynamic speed (animating the animation), you still need to use JS for that.

ps. Here an example found in the wild: The logo of Impending.

I’m doing this! Now what to animate…

212 Notes

  1. awesomepotatoes reblogged this from blackstarrr
  2. blackstarrr reblogged this from thoughtfulwonderings
  3. thoughtfulwonderings reblogged this from mahouteki
  4. mahouteki reblogged this from simurai and added:
    FANTASTIC.
  5. hendriono reblogged this from simurai
  6. jaskat0 reblogged this from simurai
  7. arkie08 reblogged this from simurai and added:
    Cool so cool. i miss programming.. nice the way it gives option to see the previous and future state..
  8. toruta reblogged this from simurai
  9. madoberi reblogged this from simurai
  10. brainshockremix reblogged this from nicodoll
  11. mathiasreblogs reblogged this from simurai
  12. supersonicpolarflare reblogged this from simurai and added:
    what i like, explanations :D PS my firs upload...my drawings will be up soon
  13. leialdelaney reblogged this from thesnippetx
  14. kosardamla reblogged this from simurai
  15. ladybetha reblogged this from simurai
  16. notnicolle reblogged this from nicodoll
  17. iwanttoknowwhatifeel reblogged this from simurai
  18. nagomu-me reblogged this from simurai

Are you interested in working with me? I'm available for freelance web or design projects! Contact me.