Expressions/Scripts/Presets

Moderators: Disciple, zlovatt

 
johannesstromme
Topic Author
Posts: 1
Joined: Fri Nov 27, 2015 5:23 am

Random pulse expression

Sun Nov 29, 2015 2:09 pm

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!

Who is online

Users browsing this forum: No registered users and 2 guests