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?

Share this post

Link to post
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%)"


Share this post

Link to post
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

Share this post

Link to post
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.

Share this post

Link to post
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

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.