Jump to content
Search Community

repat not working for me?

timaging test
Moderator Tag

Recommended Posts

Hi,

 

trying to get some TweenMax.to things to repeat to the beginning of a timeline, but it's not repeating. Here's all the code I think you need:

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

TweenMax.to(sheetPiling, 3, {colorTransform:{tint:0xb9b9b9, tintAmount:0.5, brightness:0.1}, autoAlpha:.3, delay:6});
TweenMax.to(junttan, 3, {colorTransform:{tint:0xb9b9b9, tintAmount:0.5, brightness:0.1}, autoAlpha:.3, delay:6});
TweenMax.to(hpiles, 3, {colorTransform:{tint:0xb9b9b9, tintAmount:0.5, brightness:0.1}, autoAlpha:.3, delay:6});
TweenMax.to(steelpipetxt, 3, {autoAlpha:1, delay:7});

var myTimeline:TimelineMax = new TimelineMax({onComplete:myFunction});

function myFunction():void {
   myTimeline.repeat = 2;
}

 

 

the only thing I'm concerned about is the timelinemax code at the end. This appears to be correct to me?

 

Dave

Link to comment
Share on other sites

I also just tried this, but I'm being told I need a rightparen before the colon. This is exactly the way I've done other arrays and it worked before:

timeline.appendMultiple([new TweenMax(sheetPiling,  3, {autoAlpha:1, ease:Cubic.easeInOut}),
                        new TweenMax(junttan,  3, {autoAlpha:1, ease:Cubic.easeInOut, delay:.5}),
                        new TweenMax(hpiles,  3, {autoAlpha:1, ease:Cubic.easeInOut, delay:1}),
                        new TweenMax(pipe,  3, {autoAlpha:1, ease:Cubic.easeInOut, delay:1.5}),

                        new TweenMax(sheetPiling, 3, {colorTransform:{tint:0xb9b9b9, tintAmount:0.5, brightness:0.1}, autoAlpha:.3, delay:6}),
                        new TweenMax(junttan, 3, {colorTransform:{tint:0xb9b9b9, tintAmount:0.5, brightness:0.1}, autoAlpha:.3, delay:6}),
                        new TweenMax(hpiles, 3, {colorTransform:{tint:0xb9b9b9, tintAmount:0.5, brightness:0.1}, autoAlpha:.3, delay:6}),
                        new TweenMax(steelpipetxt, 3, {autoAlpha:1, delay:7}),

                        new TweenMax(pipe, 3, {colorTransform:{tint:0xb9b9b9, tintAmount:0.5, brightness:0.1}, autoAlpha:.3, delay:18}),
                        new TweenMax(junttan, 3, {colorTransform:{tint:0xb9b9b9, tintAmount:0, brightness:1}, autoAlpha:1, delay:18}),
                        new TweenMax(hpiles, 3, {colorTransform:{tint:0xb9b9b9, tintAmount:0.5, brightness:0.1}, autoAlpha:.3, delay:18}),
                        new TweenMax(steelpipetxt, 3, {autoAlpha:0, delay:18}),
                        new TweenMax(junttantxt, 3, {autoAlpha:1, delay:19}),

                        new TweenMax(pipe, 3, {colorTransform:{tint:0xb9b9b9, tintAmount:0.5, brightness:0.1}, autoAlpha:.3, delay:30}),
                        new TweenMax(junttan, 3, {colorTransform:{tint:0xb9b9b9, tintAmount:0.5, brightness:0.1}, autoAlpha:.3, delay:30}),
                        new TweenMax(hpiles, 3, {colorTransform:{tint:0xb9b9b9, tintAmount:0, brightness:1}, autoAlpha:1, delay:30}),
                        new TweenMax(junttantxt, 3, {autoAlpha:0, delay:30}),
                        new TweenMax(hpiletxt, 3, {autoAlpha:1, delay:31}),

                        new TweenMax(pipe, 3, {colorTransform:{tint:0xb9b9b9, tintAmount:0.5, brightness:0.5}, autoAlpha:.3, delay:40}),
                        new TweenMax(junttan, 3, {colorTransform:{tint:0xb9b9b9, tintAmount:0.5, brightness:0.1}, autoAlpha:.3, delay:40}),
                        new TweenMax(hpiles, 3, {colorTransform:{tint:0xb9b9b9, tintAmount:0.5, brightness:0.1}, autoAlpha:.3, delay:40}),
                        new TweenMax(sheetPiling, 3, {colorTransform:{tint:0xb9b9b9, tintAmount:0, brightness:1}, autoAlpha:1, delay:40}),
                        new TweenMax.to(hpiletxt, 3, {autoAlpha:0, delay:40}),
                        new TweenMax(sheetpilingtxt, 3, {autoAlpha:1, delay:41})], repeat:2);

Link to comment
Share on other sites

I think it has to do where you put your repeat.

 

var yourtimeline:TimelineMax = new TimelineMax({repeat:2,onComplete:myFunction});

yourtimeline.insert(new TweenMax(mc, 3, {colorTransform:{tint:0xffccff, tintAmount:0.5, brightness:0.1}, autoAlpha:.3, delay:6}));

function myFunction():void {
       yourtimeline.play();
}

Link to comment
Share on other sites

cool... this works-I don't understand the syntax, but THANKS!!

Yeah, just to clarify, the reason it didn't work with your previous code was that you set the repeat AFTER THE TIMELINE COMPLETED. So it was done and removed from the root timeline and then you set it to repeat. It technically would have worked if you put play() right after setting the repeat, but LynnB's suggestion is a much better, cleaner solution. Thanks LynnB.

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