Jump to content
Search Community

back to the addChild!

vdheyning test
Moderator Tag

Recommended Posts

Hello!

 

I totally understand that you don't have the time to write non tweenlite related code, but I thought I'd give this question a shot anyway, I figured out to mathRandomly addChild, but is there a way that I can get the dots to tweenlite in from alpha 0 sequentially?

Below the code that just addsChild...

 

Thanks!

 

Fam

 

for (var i:int = 0; i < 200; i++){

var circle:MovieClip = new Circle();

 

circle.x = Math.random() * this.stage.stageWidth - (circle.width * 0.5);

circle.y = Math.random() * this.stage.stageHeight - (circle.height * 0.5);

 

addChild(circle);

}

Link to comment
Share on other sites

Just use the delay special property:

 

for (var i:int = 0; i     var circle:MovieClip = new Circle();

   circle.x = Math.random() * this.stage.stageWidth - (circle.width * 0.5);
   circle.y = Math.random() * this.stage.stageHeight - (circle.height * 0.5);

   addChild(circle);

   TweenLite.from(circle, 1, {autoAlpha:0, delay:i * 0.05});
}

 

You could create a TimelineLite and append() each tween instead of using the delay property if you want - that way you could control the entire sequence as a whole anytime. But if you don't need that capability, just use the delay.

Link to comment
Share on other sites

I assumed you knew that you had to activate the AutoAlphaPlugin first - sorry, I should have made sure you understood that. You can just use TweenMax if you don't want to mess with the activation because TweenMax automatically activates several plugins including AutoAlpha. Or you can just add this code once in your SWF:

 

import com.greensock.plugins.*;
TweenPlugin.activate([AutoAlphaPlugin]);

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