Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects simple javascript (I hope!)

  • simple javascript (I hope!)

    Posted by Mark Warner on January 26, 2006 at 12:12 pm

    Hello all

    Please help with (hopefully) a simple piece of javascript.

    I want to randomly animate the opacity of a layer between two values, 0 and 100% – no inbetween values (so the layer is either on or off). Ideally I also want to be able to change the framerate/speed at which this occurs (similar to the “wiggle” function).

    This will be applied to about 40 or so layers, each layer has a hand painted splatter spread over predifined areas of the screen, so I want a real noisy and dynamic feel. No movement, just opacity.

    I don’t know where to start! Can anyone help?

    Many thanks.

    Mark Warner replied 20 years, 3 months ago 2 Members · 2 Replies
  • 2 Replies
  • Filip Vandueren

    January 26, 2006 at 2:49 pm


    posterizeTime(3); // in fps
    random(100)>50 ? 100 : 0;

    If you preceed any expression with a “posterizeTime”, you will limit how many times per second the value is updated.
    The second line is shorthand for:

    if a random number from 0-100 > 50, then opacity=100 else opacity=0

    If you need to, you can pickwhip the value inbetween the brackets of posterizeTime to an expression control slider.
    That way you can alter the framerate dynamically.
    But it would be best to use Hold keyframes on the value of that slider to jump from say 3fps to 2 fps, because the it will not interpolate intuitively.

  • Mark Warner

    January 26, 2006 at 3:12 pm

    Exactly what I’m after! Thank you.

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy