Jump to content

Search In
  • More options...
Find results that contain...
Find results in...

SteppedEase - easing between between frames?

Recommended Posts

SteppedEase is convenient for animating in a linear fashion between frames in a spritesheet, but what if I want an easing between each step? Is this possible? Let's say I want a monster to die and go through 10 frames of animation, but I don't want it to go through the frames in linear jumps. What if I'd like a Quad.easeOut through the steps for a more dramatic effect? Is that possible?

Link to comment
Share on other sites

Haven't messed with that before. Here's how I'm currently solving my problem... I'm using a few delayed sets that transition into a SteppedEase. This works, but I'll look into CustomEase, too.

tl.set(test.mob.element, {
  overwrite: 1,
  backgroundPosition: '0% -300%'
}).set(test.mob.element, {
  backgroundPosition: '-100% -300%'
}, '+=.13')
  .set(test.mob.element, {
  backgroundPosition: '-200% -300%'
}, '+=.12')
  .set(test.mob.element, {
  backgroundPosition: '-300% -300%'
}, '+=.11')
  .to(test.mob.element, .4, {
  startAt: {
    backgroundPosition: '-400% -300%'
  backgroundPosition: '-900% -300%',
  ease: SteppedEase.config(5),
  onComplete: function(){
    var filters = {
      opacity: 'opacity(100%)',
      brightness: "brightness(100%)"

    var tl = new TimelineMax({
      onUpdate: function(){
        test.filters.death(test.mob.element, filters);
    tl.to(filters, 1.5, {
      opacity: 'opacity(0%)',
      brightness: "brightness(0%)"


Link to comment
Share on other sites

Another approach is to tween a frame property on a generic object. That works great for packed sprite sheets. Shown here using canvas, but the same concept could be applied to html.


See the Pen bqEamV?editors=0010 by osublake (@osublake) on CodePen


  • Like 4
  • Thanks 1
Link to comment
Share on other sites

That's a good idea, Blake. You could use division to round down to the nearest hundred to set the backgroundPosition.

Link to comment
Share on other sites

The frame property is actually being rounded by GSAP in that example.


And in that example, the position and size of every frame is stored in this file, so I'm using the frame property as an index value to lookup the frame object from an array.



This is what the sprite sheet looks like.



  • Like 4
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.