Jump to content
Search Community

adding movieclip to stage

vdheyning test
Moderator Tag

Recommended Posts

Hello there!

 

wondering if you could help me out:

I'm sure this code could be written less verbose, I just don't quite know how:

 

see attached

 

this is what I'm trying to achieve, as the first copy alphas in, the dots appear, at first as shown, but then faster and randomly (mathRandom?) until they cover the whole area, at which point the shadow comes off and they tint to a solid (this last part I can figure out) (they idea being that they then form a solid color background)

 

I just need some help with optimizing the appearing of the balls and the faster randomly appearing of said balls.

Could you be of any help here?

 

I would really appreciate it!

 

 

Thanks, Fam

Link to comment
Share on other sites

I don't have time to write the code for you, but here are a couple of pointers:

 

1) To randomly position the balls on the stage (assuming you want them to be able to bleed off the edge of the screen by half their width/height), you can use this:

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

 

2) If you want to ensure that the entire screen is covered, you can't only rely on the random code because...it's random - there's no way of absolutely guaranteeing that the whole screen will be covered. instead, you'd have to loop through and place dots across the screen to ensure they're covering everything. Then you can randomly fade those in and randomly place others on top of those just to make it look more randomized in terms of placement. You could also vary the sizes to have some fill more space.

 

3) I noticed you're appending a bunch of autoAlpha tweens that have the same duration. You could condense it like this:

 

/*--OLD--
myTimeline.append(new TweenLite(copy1, 2, {autoAlpha:1}));
myTimeline.append(new TweenLite(mc1, .5, {autoAlpha:1}));
myTimeline.append(new TweenLite(mc2, .5, {autoAlpha:1}));
myTimeline.append(new TweenLite(mc3, .5, {autoAlpha:1}));
myTimeline.append(new TweenLite(mc4, .5, {autoAlpha:1}));
myTimeline.append(new TweenLite(mc5, .5, {autoAlpha:1}));
myTimeline.append(new TweenLite(mc6, .5, {autoAlpha:1}));
myTimeline.append(new TweenLite(mc7, .5, {autoAlpha:1}));
myTimeline.append(new TweenLite(mc8, .5, {autoAlpha:1}));
myTimeline.append(new TweenLite(mc9, .5, {autoAlpha:1}));
myTimeline.append(new TweenLite(mc10, .5, {autoAlpha:1}));
myTimeline.append(new TweenLite(mc11, .5, {autoAlpha:1}));
myTimeline.append(new TweenLite(mc12, .5, {autoAlpha:1}));
myTimeline.append(new TweenLite(mc13, .5, {autoAlpha:1}));
myTimeline.append(new TweenLite(mc14, .5, {autoAlpha:1}));
myTimeline.append(new TweenLite(mc15, .5, {autoAlpha:1}));
myTimeline.append(new TweenLite(mc16, .5, {autoAlpha:1}));
*/

//--NEW--
myTimeline.appendMultiple( TweenMax.allTo([copy1, mc1, mc2, mc3, mc4, mc5, mc6, mc7, mc8, mc9, mc10, mc11, mc12, mc13, mc14, mc15, mc16], 0.5, {autoAlpha:1}, 0.5) );

 

Hope that helps.

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