Jump to content
GreenSock

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

How to save a bezierThrough tween in a var?

Recommended Posts

Hi,

 

I'm using the latest version for AS3 (greensock-v12-as3) in Flash Pro CS6 with a Shockingly Green membership.

 

I'd like to save a bezierThrough tween in a var, so that I can reverse it later on, but I only know how to use bezierThrough by calling the TweenMax.to or TweenMax.from methods, so don't know how to instantiate a bezierThrough.

 

I'd like to use this syntax:

"var myTween:TweenMax = new TweenMax(-mybezierThrough tween-);"

 

but how to do it when bezierThrough syntax is:

TweenMax.to(mc, 3, {bezierThrough:[{x:300, y:345}], orientToBezier:true, ease:Bounce.easeOut});

 

Thanks,

 

Carin

Link to post
Share on other sites

Hi and Welcome to the GreenSock forums.

 

I'm a little confused by the code you posted:

 

"var myTween:TweenMax = new TweenMax(-mybezierThrough tween-);"

 

There isn't a way to pass a single variable into new TweenMax().

 

To answer the following request:

 

I'd like to save a bezierThrough tween in a var, so that I can reverse it later on

 

You can just do this:

 

 

import com.greensock.*;
import com.greensock.plugins.*;
import com.greensock.easing.*;

TweenPlugin.activate([bezierThroughPlugin, BezierPlugin]);

var myBezier:TweenMax = new TweenMax(mc, 3, {bezierThrough:[{x:300, y:345}, {x:400, y:200}], orientToBezier:true, ease:Bounce.easeOut});

stage.addEventListener(MouseEvent.CLICK, stageClick);

function stageClick(e:MouseEvent):void{
myBezier.reverse();
}

//when the stage is clicked, the tween will reverse

 

does this help?

  • Like 1
Link to post
Share on other sites

Yes, thanks.

 

I used "-mybezierThrough tween-" in this forum just as a placeholder for the whole code for my bezierThrough tween. Sorry for the confusion.

 

Thanks again,

 

Carin

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

×