Jump to content
GreenSock

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

Circle2D and 'Progress'

Recommended Posts

Greetings,

 

So I've been running in circles (no pun intended) trying to access the progress of a tween so that I can make it perform different functions at diffent points of progress, ie:

 


var circleTween:TweenMax = TweenMax.to(myShape, 4, {circlePath2D:{path:circle,
                                                       startingAngle:0,
                                                    endAngle:360,
                                                    direction:Direction.COUNTER_CLOCKWISE},
                                       ease:Linear.easeNone});

trace(circleTween.totalProgress);        //outputs: function Function() {}
trace(int(circleTween.totalProgress));    //outputs: 0

I've tried messing around with get progress as well, but am clearly missing the mark on something.

 

Even using the code from the snorkl.tv Orbit - which clearly works in the demo - refuses to play nice and let me 'do something' based on progress...*Edit* and actually throws errors on the lines in which he has used currentProgress

 

Any thoughts, ideas, suggestions would be greatly appreciated.

Link to comment
Share on other sites

With GSAP v12, getters and setters were changed to functions. The snorkl demo may have been using v11 which is why it would have thrown errors changing between v11 and v12. A list of changes between v11 and v12 is available at http://www.greensock.com/v12/

 

* All the old getter/setter properties like totalTime, duration, paused, etc. are now methods like totalTime(), duration(), and paused() methods for better compatibility with JavaScript and slightly better memory efficiency. It also allows for passing extra parameters in some cases like totalTime(time, suppressEvents). If you don’t pass a parameter to the method, it acts as a getter. If you do pass a parameter, it acts as a setter. For example:

myTween.duration(3); //sets
var dur:Number = myTween.duration(); //gets

 

You should find that totalProgress returns correctly using this:

trace(circleTween.totalProgress());
Link to comment
Share on other sites

Cheers - that seems to have done the trick.  Now to figure out where and how to place them properly, and we're in business XD

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