Jump to content
Search Community

How to loop tweenlite animation twice & stop? [SOLVED]

Guest evolve
Moderator Tag

Recommended Posts

Guest evolve

Hello,

I am in desperate need of some help. I believe what I want to do is really easy...however I just cannot figure it out. Basically I have a banner advertisement that has a numbers of tweens, nothing too fancy and I just want it to loop two times and stop. Just like the banner ads you see on websites. I've read, searched and to NO avail can I figure this out on my own. Please help. I would truly appreciate it. Here's my code:

 

import gs.TweenLite;

import gs.easing.*

 

 

//--Welcome

TweenLite.from(welcome, 1, {_x:-100, _y:8, _alpha:100});

TweenLite.to(welcome, 1, {_x:-300, _y:26, delay:11.5, overwrite:0, _alpha:0});

 

//--Better

TweenLite.from(better, 1, {_x:-295, _y:-10, delay:1, _alpha:0, ease:Back.easeOut});

TweenLite.to(better, 1, {_x:500, _y:-10, delay:3, overwrite:0, _alpha:0});

 

//--Responsive

TweenLite.from(responsive, 1, {_x:-295, _y:1, delay:4, _alpha:0, ease:Back.easeOut});

TweenLite.to(responsive, 1, {_x:500, _y:1, delay:6, overwrite:0, _alpha:0});

 

//--FirstMerit

TweenLite.from(firstmerit, 1, {_x:-295, _y:1, delay:7, _alpha:0, ease:Back.easeOut});

TweenLite.to(firstmerit, 1, {_x:500, _y:1, delay:11.5, overwrite:0, _alpha:0});

 

//--More Bank

TweenLite.from(more_bank, 1, {_x:438, _y:37, delay:9, _alpha:0});

TweenLite.to(more_bank, 1, {_x:438, _y:115, delay:11.5, overwrite:0, _alpha:0});

 

//--FM Logo

TweenLite.from(fm_logo, 3, {_x:46, _y:8, delay:12.5, overwrite:0, _alpha:0});

 

//--More Bank

TweenLite.from(more_bank_big, 1, {_x:241, _y:29, delay:14, _alpha:0});

 

//--Get More Button

TweenLite.from(button_get_more, 1, {_x:0, _y:21, delay:15.5, overwrite:0, _alpha:0, repeat:2, ease:Back.easeOut});

 

 

---------------

 

All I want it to do is loop back to the beginning of this animation two times and stop. All of my content is on ONE frame.

Thank you so much!

tb-

Link to comment
Share on other sites

There are many ways to accomplish this, but I'm fond of using TimelineMax because it makes it so easy to control the entire sequence as a whole and set a repeat value:

 

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

var t:TimelineMax = new TimelineMax({repeat:2});

//--Welcome
t.insert( TweenLite.from(welcome, 1, {_x:-100, _y:8, _alpha:100}), 0);
t.insert( TweenLite.to(welcome, 1, {_x:-300, _y:26, _alpha:0}), 11.5);

//--Better
t.insert( TweenLite.from(better, 1, {_x:-295, _y:-10, _alpha:0, ease:Back.easeOut}), 1);
t.insert( TweenLite.to(better, 1, {_x:500, _y:-10, _alpha:0}), 3);

//--Responsive
t.insert( TweenLite.from(responsive, 1, {_x:-295, _y:1, _alpha:0, ease:Back.easeOut}), 4);
t.insert( TweenLite.to(responsive, 1, {_x:500, _y:1, _alpha:0}), 6);

//--FirstMerit
t.insert( TweenLite.from(firstmerit, 1, {_x:-295, _y:1, _alpha:0, ease:Back.easeOut}), 7);
t.insert( TweenLite.to(firstmerit, 1, {_x:500, _y:1, _alpha:0}), 11.5);

//--More Bank
t.insert( TweenLite.from(more_bank, 1, {_x:438, _y:37, _alpha:0}), 9);
t.insert( TweenLite.to(more_bank, 1, {_x:438, _y:115, _alpha:0}), 11.5);

//--FM Logo
t.insert( TweenLite.from(fm_logo, 3, {_x:46, _y:8, _alpha:0}), 12.5);

//--More Bank
t.insert( TweenLite.from(more_bank_big, 1, {_x:241, _y:29, _alpha:0}), 14);

//--Get More Button
t.insert( TweenLite.from(button_get_more, 1, {_x:0, _y:21, _alpha:0, ease:Back.easeOut}), 15.5);

 

I'd definitely recommend watching the video at

Link to comment
Share on other sites

Guest evolve

You guys rock!!!

That worked exactly the way I needed it.

So saved me...these are due today.

Thank you!

tb :D

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