Repeat a little function onComplete.

Recommended Posts

HI, I'm really new to all this, I just looked at the 'Getting Started' video.

My question is: is this the right way to get that result (the blue line shrink from left to right in an infinite loop) or there is another/better way to achive this result?

At first i tried this code:

TweenMax.to(".light", 0.8, {left:0, delay:1.7, ease:Power0.easeOut});
TweenMax.to(".dark", 0.8, {left:0, delay:3.7, ease:Power4.easeOut});
TweenMax.to(".dark", 0.6, {width:0, left:500, delay:4.2, ease:Power0.easeOut});
TweenMax.to(".dark", 0, {left:-500, width:500, delay:5, onComplete:complete, repeat:-1});
function complete() {
	TweenMax.to(".dark", 0.8, {left:0, delay:2, ease:Power4.easeOut});
	TweenMax.to(".dark", 0.8, {width:0, left:500, delay:2.5, ease:Power0.easeOut});
	TweenMax.to(".dark", 0, {left:-500, width:500, delay:4});

But doesn't seems to works, it only works withouth:


at the end of the line, and repeat only once.

I'm sure I'm missing something...

Thanks a lot :)

Share this post

Link to post
Share on other sites

No worries, so do I. And that's the fun part!

Share this post

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.