Jump to content
GreenSock

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

How to run two TweenMax.allFrom statement

Recommended Posts

I have two text,such as myTextField1 and myTextField2, I want to display the two text display,for example:

First display myTextField1 and myTextField1 disappear,second display myTextField2 and myTextField2 disappear.

Then display myTextField1 and myTextField1 disappear,then display myTextField2 and myTextField2 disappear.

and so on,not stop.

 

So I write following code:

var tl:TimelineMax=new TimelineMax({repeat:-1,yoyo:true,repeatDelay:2});
var stf1:SplitTextField = new SplitTextField(myTextField1);
tl.appendMultiple(TweenMax.allFrom(stf1.textFields, 1, {y:"-100", autoAlpha:0, ease:Elastic.easeOut}, 0.05));
stf2= new SplitTextField(myTextField2);
tl.appendMultiple(TweenMax.allFrom(stf2.textFields, 1, {y:"-100", autoAlpha:0, ease:Elastic.easeOut}, 0.05));
addChild(stf1);
addChild(stf2);

 

I find the result isn't what I wanted! It display myTextField1,but when myTextField1 is still on,and show myTextField2!!!

I hope after myTextField1 disappear,and then myTextField1 appear.How to correct above code?

 

Thanks

Link to comment
Share on other sites

this is a good problem to solve with timelinemax, but start by fixing this

 

var stf:SplitTextField = new SplitTextField(myTextField1);

TweenMax.allFrom(stf.textFields, 1, {y:"-100", autoAlpha:0, ease:Elastic.easeOut}, 0.05);

var stf2:SplitTextField = new SplitTextField(myTextField2);

TweenMax.allFrom(stf2.textFields, 1, {y:"-100", autoAlpha:0, ease:Elastic.easeOut}, 0.05);

addChild(stf)

 

you for your second splitTextField you were using the same name as the first one: stf so the first one was getting overwritten before it could even be animated.

 

if you want tweens to repeat you need to use a repeat property most likely in combination with yoyo:true. if you want to wait for for a tween to happen, use delay.

 

i have to run. if you don't get this fixed i will check in later. ultimately timelinelite/max will make the sequencing much easier to manage.

http://www.greensock.com/as/docs/tween/ ... enMax.html

 

carl

Link to comment
Share on other sites

Thanks for carl,I modify my code,like follows:

 

var tl:TimelineMax=new TimelineMax({repeat:-1,yoyo:true,repeatDelay:2});
var stf1:SplitTextField = new SplitTextField(myTextField1);
tl.appendMultiple(TweenMax.allFrom(stf1.textFields, 1, {y:"-100", autoAlpha:0, ease:Elastic.easeOut}, 0.05));
stf2= new SplitTextField(myTextField2);
tl.appendMultiple(TweenMax.allFrom(stf2.textFields, 1, {y:"-100", autoAlpha:0, ease:Elastic.easeOut}, 0.05));
addChild(stf1);
addChild(stf2);

 

I find the result isn't what I wanted! It display myTextField1,but before myTextField1 disappear,and it begin display myTextField2!!!

I hope after myTextField1 disappear,and then myTextField1 appear.How to correct above code?

Link to comment
Share on other sites

good job a at incorporating into TimlineMax!

 

just a few small adjustments:

 

var tl:TimelineMax=new TimelineMax({repeat:-1});

var stf1:SplitTextField = new SplitTextField(myTextField1);

tl.appendMultiple(TweenMax.allFrom(stf1.textFields, 4, {y:"-100", autoAlpha:0, ease:Elastic.easeOut, repeat:1, yoyo:true}, 0.05));

var stf2:SplitTextField= new SplitTextField(myTextField2);

tl.appendMultiple(TweenMax.allFrom(stf2.textFields, 4, {y:"-100", autoAlpha:0, ease:Elastic.easeOut, repeat:1, yoyo:true}, 0.05));

addChild(stf1);

addChild(stf2);

 

text 1 comes in

text 1 goes away

text 2 comes in

text 2 goes away

text 1 comes in

text 1 goes away

...

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