Jump to content
Search Community

Stepped Tween with Limited Callbacks

charlie_says 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

I've got a tween I'm using:

 

var dValue = Math.abs(old_value - new_value);
var speed = dValue;
var delay = 1;


this._tween = TweenMax.to(this, speed, {my_value:new_value, delay:delay, overwrite: "all", ease:SteppedEase.config(dValue),onUpdate:this.setTrailGFX,onUpdateScope:this});

 

Which isn't working in quite the way I'd hoped...

 

What I'd like to do is only have my onUpdate callback fire when I reach the new integer value, this calls a number of times (depending on the speed/dValue amount.)

 

I did also look into using roundProps ( for this.my_value) but this also didn't work in quite the way I want.

 

The problem is that the this.setTrailGFX function is quite expensive, so I only really want to call it when needed.

 

Any ideas about how to work this (or do it differently) would be appreciated!

 

 

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...