ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

# How to ? Slowly and randomly stars appear

FAQ   •   VIEW ALL
 How to ? Slowly and randomly stars appear on May 1, 2006 at 9:27:38 am

Hi, I am looking for an easy solution for the following effect:

Starting with a black screen, one glowing star will appear, then a couple more, then a dozen more, etc (Kind of like how rain begins to fall!) and exponentially increase and randomly appear over 3-4 seconds until there are a few hundred starts at random sizes and opacity that fill the screen. Then on a separate layer, have about 20 of those stars twinkle...ie randomly change opacity from bright to dim. The key here is for it to be random so as not to look cheesey.

I have all the trapcode plug-ins and tried to do this with particular, however, if the stars are static, their birth and opacity over time is not affected.

I suppose I could create hundreds of layers and randomly adjust parameters, but I know that there is a way to avoid sitting at my computer for the next 3 weeks doing that.

Any suggestions or link to tutorial would be GREATLY appreciated. Thanks!!

- Chase

 Re: How to ? Slowly and randomly stars appearon May 1, 2006 at 5:05:07 pm

This might give you some ideas.

This opacity expression will make your layers turn on exponentially:

dur = 3; // time for all layers to appear (seconds)
num = 300; // total number of layers

idx = Math.exp((time/dur)*Math.log(num)) - 1;
if (idx >= index) 100 else 0

This position expression will position them randomly within the comp:

seedRandom(index,true);
random([0,0],[thisComp.width,thisComp.height])

Apply those two expressions to a star layer and duplicate it 299 times and preview it.

Dan

 Re: How to ? Slowly and randomly stars appearon May 1, 2006 at 6:39:03 pm

If you change the last line of Dan's opacity expression to:

if (idx >= index) wiggle(5,70) else 0

and the wiggle bit will make them twinkle, change the 5 (frequency) and the 70 (amplitude) to taste.

If you just want just 20 layers to twinkle have that last line in the 20 layers and the original last line in all the rest.

If you want to cluster the twinklers so they're not lost in a sea of non-twinklers, precomp (move all attributes) the 20 layers and then reduce the size of that precomp, forcing them together.

Not trying to horn in here, Dan, but I plugged in your expression and love the look with the added twinkle. Glad to see your site back up.

 Re: How to ? Slowly and randomly stars appearon May 1, 2006 at 7:00:06 pm

Horning in always welcome. :-)

Dan