Jump to content
Search Community

How do I insert a looping timeLine into a main timeLine

ngrinchenko test
Moderator Tag

Recommended Posts

I would like to have a looping animation inside my main timeline.

I can not figure out a working code for it.

 

I know that it has to be ({repeat:-1, yoyo:true});

But not sure how to construct the whole thing.

So I will start with a var =

Then I will build my time line with appendMultiple method.

How would I keep it separate in the code so it doesn't play until it is needed and how would I insert it.

Would I reference it as an mc and tween it?

 

Any chance for a sample code?

Link to comment
Share on other sites

O.K Kind of got it. GreenSock helped me with this in my previous post.

According to my novice understanding there has to be an error in the code which I can not decipher. Here is my code:

 

import com.greensock.*;
import com.greensock.easing.*;
import flash.events.MouseEvent;


var nested_timeLine:TimelineMax = new TimelineMax({repeat:-1, yoyo:true});//yoyo:true makes it go backwards and forwards//yoyo:false would make it go forward and start from beginning to forward again
nested_timeLine.appendMultiple([TweenMax.from(shape21_mc, .125, {autoAlpha:0, tint:0xffffff }),
							    TweenMax.from(shape22_mc, .125, {autoAlpha:0, tint:0x0fffff }),
							    TweenMax.from(shape23_mc, .125, {autoAlpha:0, tint:0x00ffff })],
							    -.01, //offset number, i.e. how long it waits before to start
							    TweenAlign.START,//tweens start times are aligned, or TweenAlign.SEQUENCE so they start one after another
							    0.1);


var master_timeLine:TimelineMax = new TimelineMax({timeScale: .5});

master_timeLine.append(TweenMax.from(shape11_mc, .5, {autoAlpha:0, scaleY:0}));
master_timeLine.append(TweenMax.from(shape12_mc, .5, {autoAlpha:0, scaleX:0}), -.2);
master_timeLine.append(TweenMax.from(shape13_mc, .5, {autoAlpha:0, scaleX:0}), -.2);


master_timeLine.append(nested_timeLine);
master_timeLine.insert(TweenMax.from(nested_timeLine, 1, {autoAlpha:0}), nested_timeLine.duration); //puts it right after the first iteration of "nested"

master_timeLine.append(TweenMax.from(shape3_mc, .2, {autoAlpha:0, scaleY:0}), -.1);

 

I think the error is in the line:

master_timeLine.insert(TweenMax.from(nested_timeLine, 1, {autoAlpha:0}), nested_timeLine.duration); //puts it right after the first iteration of "nested"

The tween after the inserted timeLine "shape3_mc" appears before anything else on the screen and stays this way.

In the output panes I get the following message:

ReferenceError: Error #1069: Property alpha not found on com.greensock.TimelineMax and there is no default value.

at com.greensock.plugins::AutoAlphaPlugin/onInitTween()

at com.greensock::TweenLite/init()

at com.greensock::TweenMax/init()

at com.greensock::TweenMax/renderTime()

at com.greensock.core::SimpleTimeline/renderTime()

at com.greensock::TweenLite$/updateAll()

 

Also in the line of code "master_timeLine.insert" insert does not get highlighted as an "append" would... But "insert" is the proper function?

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