Random pulse expression

Moderators: Disciple, zlovatt

Post Reply
johannesstromme
Posts: 1
Joined: November 27th, 2015, 5:23 am

Hey, I´ve googled for hours and can't seem to find any expression that does what I´m after. Also I´m not so great with expressions, so its hard for me to make complete sense of them.

I have about 20 different layers of photoshopped stars in a comp, and I want them all to be twinkling randomly using expressions. I want them to both twinkle and fade in and out randomly like real stars appear to do, not as strobe lights, which is what happens when i try the wiggle() or random() expressions. I want the twinkling and fading to pulsate at random intervals and i also want the length of each "pulse" to be randomized.

The closest solution I have found to the effect i want is this: https://forums.creativecow.net/thread/227/18549

freq = 0.1;
amp = 5;
amp*Math.sin(freq*time*Math.PI*2)

That uses a sine wave formula, which when applied as an expression creates a pulsating effect. However, each sine wave has exactly the same amplitude and frequency, and if I apply this expression to all 20 stars, they all pulse in and out at the exact same times with exact same shine and duration. The "Shine" effect is a good look, but it is a hassle to keyframe each of the 20 stars differently to make it appear convincingly random.

I would really appreciate a swift reply to this! Thank you so much for any help!
Post Reply