Page 1 of 1

Simple expression for varying opacity over specific time

Posted: March 28th, 2008, 11:50 am
by gerardjuarez
Hello,

I have a layer I want to vary the opacity of in a random way between certain values so I enable expressions for the opacity and use the following:

random(60,20)

Easy.

However, I don't want this value to be randomized on every frame, but rather every 15 frames or .5 seconds. It's probably way simple for some of you, but for me scripting is rather challenging!

Thanks!

-GJ

Re: Simple expression for varying opacity over specific time

Posted: March 28th, 2008, 12:08 pm
by Paul Tuersley
If you want something that gradually changes over time, you could set the Opacity value to the middle of your desired value range (i.e halfway between 20-60 is 40) then use this expression. The first number is wiggles per second, the second number is the max amount the value will change.
wiggle(1,20);

Or if you want an abrupt change in value, but not on every frame, you could use this expression. Although the second line would normally create a new random value between 20 and 60 on each frame, the preceding posterizeTime(frames per second) method is lowering the frame rate of the resulting expression.
posterizeTime(2);
random(20,60);

Re: Simple expression for varying opacity over specific time

Posted: March 28th, 2008, 12:32 pm
by gerardjuarez
perfect - works for me! Thank you much! -g