Jump to content
GreenSock

kaptnkill

Tweening object copy seem to set them to original object

Recommended Posts

Hi all, first of all thanks for this great Tweening engine !!

I have a small problem and i am not sure if this is due to my code or a param i could use with TweenMax

i have an instance of a class in wich i set an object :

{blurFilter:{blurX:50,blurY:50},ease:Regular.easeIn}

Obviously i want to be able to reuse the instace with any clip in a Tween.to or Tween.from

 

Here are the steps :

1. click - open window with blur 50 to 0 , with Tween.from, with remove eve though i shouldnt need it since it's 0 at the end

2.click - close window with blur 0 to 50, with Tween.to with remove since it's 50 at the end

 

The problem is that on step 2, it does blur 50 to 0 and not blur 0 to 50 but i use the same instance of the class for both !?

 

But when i define two objects :myClass({blurFilter:{blurX:50,blurY:50},ease:Regular.easeIn},{blurFilter:{blurX:50,blurY:50},ease:Regular.easeIn}) it works

 

is it the Tween.from and Tween.to causing the problem ?

 

Thanks for any help

Link to comment
Share on other sites

I don't understand your question. Could you restate it? And yes, TweenLite.from() and TweenLite.to() are very different (opposite actually).

Link to comment
Share on other sites

Sorry for my english as i am Canadian french :)

 

let say i use a class to keep different animation props :

var slideWithBlur:WinAnimType=new WinAnimType([{ease:Strong.easeOut,startAt:{x:1000,y:'T'}},{x:-2000,ease:Regular.easeIn}],[.75],[{blurFilter:{blurX:100}}]);

 

so i could do :

 

manager.openWin('win1',slideWithBlur,WinType.BASIC);

 

basically, i have 3 params

1:An array containing two object (in, out)

2:An array containing one or two number (speed) if only one number exists, it is used for in and out animation

3:An array containing one or two object (FX) if only one number exists, it is used for in and out animation

 

Two tweens are used at the same time with overwrite 0 (one for the basic props and the second for the Fx, mainly blur)

 

In this example, the object comes from the right (x:-1000) and aligned to top (y: 'T') (i parse the letter in my code and inject it in the tween props)

in addition, the object is blurred from 100, to 0 (i use Tween.from for the blurIn), then from 0 to 100 (i use Tween.to for the blurOut)

 

The problem is that on blurOut , my objetc will do 0 to 100 for the blur instead of 100 to 0 like it should (that is when i reuse the BlurFilter props for the in and out)

 

But if i do [{blurFilter:{blurX:100}},{blurFilter:{blurX:100}}] as third param instead of [{blurFilter:{blurX:100}}] it work as expected

 

Shouldnt the same work for the in (from) and out (to)

 

Here is the get function returning from inside the class WinAnimType:

public function get animFxIn():Object {
		return $fxAnimProps[0];
	}
//the array contain only one objet, used it for in and out
public function get animFxOut():Object {
return ($fxAnimProps[1]==null) ? $fxAnimProps[0]:$fxAnimProps[1];
}

 

I hope it is clearer now,and many thanks again !!!

Link to comment
Share on other sites

I think there must be something else going on in your code that's causing the problems, and it's very difficult to say without seeing the tweening code. Maybe it has to do with the fact that you're switching to() and from() or that you're using a startAt incorrectly. I would recommend trying to simplify and isolate the issue as much as you can in your FLA. In fact, I find it useful to create a separate SUPER-SIMPLE FLA that only does the most basic thing, and then add functionality until it breaks so that you see where the issue is.

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