Jump to content
Search Community

SteppedEase - easing between between frames?

Halcyon test
Moderator Tag

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

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

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.

https://s3-us-west-2.amazonaws.com/s.cdpn.io/106114/fighter3.js

 

This is what the sprite sheet looks like.

MBfZqUV.png

 

  • 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.
×
×
  • Create New...