Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Random blink for opacity

  • Random blink for opacity

    Posted by Danielle Masek on November 18, 2011 at 7:52 pm

    I know this is a common topic, but I never found an answer to this specifically: apply a random blinking effect (to text in this case) where there is no sort of fade in/fade out of visibility–just on/off. I’ve done this manually by setting opacity keys as one frame opacity 0, next frame opacity 100, next frame opacity 0. and doing this spread out randomly. It’s a pain.
    Is this what the wiggler is for? It seems like it applies keyframes very evenly spaced when applied, which is not what I want. I want it random. I guess I’m not sure how it’s being random when the spacing is completely even. It also looks like its easing in/out–am I wrong here?

    And an off question…I’m sometimes not sure where to post my question, as it seems this could go in the AE basic forum, as well as the Techniques forum (b/c I’m asking about a technique–I think).

    **I look down at where you’re standing
    Flock of sheep all on display
    With all your lies piled up around you
    I can take it all away**

    Roland R. kahlenberg replied 14 years, 5 months ago 3 Members · 7 Replies
  • 7 Replies
  • Walter Soyka

    November 18, 2011 at 8:16 pm

    Here’s a quick expression to do exactly this. Alt-click the Opacity property for the layer you want to apply this to, and copy and paste the following code:
    r = random();
    if (r < 0.5) 0 else 100;

    Expressions are evaluated every frame. For each frame, r will be assigned a random number between 0 and 1. If r is less than 0.5 (half-way between 0 and 1), the expression will return 0 to the Opacity property (totally transparent). If not, the expression will return 100 (totally opaque).

    If you want to favor transparency or opacity, just change the 0.5 constant.

    Walter Soyka
    Principal & Designer at Keen Live
    Motion Graphics, Widescreen Events, Presentation Design, and Consulting
    RenderBreak Blog – What I’m thinking when my workstation’s thinking
    Creative Cow Forum Host: Live & Stage Events

  • Danielle Masek

    November 18, 2011 at 11:52 pm

    Thank you.
    Question…I want the layer to, for the first 8 seconds, be transparent, then at like 8 sec, 1 frame, to start the blinking, then 2 seconds later, be transparent again, how would I need to modify the expression? (I know I can just move the layer over but assuming I could not for some reason).

    **I look down at where you’re standing
    Flock of sheep all on display
    With all your lies piled up around you
    I can take it all away**

  • Roland R. kahlenberg

    November 19, 2011 at 3:58 am

    This should work –

    //Start Script
    if ((time <=8) || (time >10)){
    0
    } else {
    r=random(1);
    if (r<.5)
    0
    else
    100
    }
    // End Script

    FWIW, the “||” is the Javascript OR operator.

    HTH
    RoRK

    Intensive AE & Mocha Training in Singapore and Malaysia
    Adobe ACE/ACI (version 7) & Imagineer Systems Inc Approved Mocha Trainer

  • Danielle Masek

    November 21, 2011 at 9:24 pm

    I pasted that script in, changing the 8 and 10 (assuming that was referring to time) to 8:21 and 10:19 b/c those are actually the exact times. I got this error:
    after effects warning: expected: )
    Expression disabled

    **I look down at where you’re standing
    Flock of sheep all on display
    With all your lies piled up around you
    I can take it all away**

  • Walter Soyka

    November 21, 2011 at 9:35 pm

    [Danielle Masek] “I pasted that script in, changing the 8 and 10 (assuming that was referring to time) to 8:21 and 10:19 b/c those are actually the exact times. I got this error:
    after effects warning: expected: )
    Expression disabled”

    After Effects expressions think in decimal time, not seconds and frames, and the colons are not syntactically correct.

    Assuming you’re dealing with 29.97 fps, 8:21 is 8.7 (or 8 + 21/30), and 10:19 is 10.6333 (or 10 + 19/30). If you’re working in 23.976, it’s 8.875 and 10.791666, respectively.

    Walter Soyka
    Principal & Designer at Keen Live
    Motion Graphics, Widescreen Events, Presentation Design, and Consulting
    RenderBreak Blog – What I’m thinking when my workstation’s thinking
    Creative Cow Forum Host: Live & Stage Events

  • Danielle Masek

    November 21, 2011 at 9:49 pm

    I’m working in 24 fps. So would that be 8 + 21/24?

    **I look down at where you’re standing
    Flock of sheep all on display
    With all your lies piled up around you
    I can take it all away**

  • Roland R. kahlenberg

    November 22, 2011 at 3:13 am

    YUP!
    // Start
    if ((time <=(8+21/24)) || (time >10)) {
    0
    } else {
    r=random(1);
    if (r<.5)
    0
    else
    100
    }
    //EOS

    HTH
    RoRK

    Intensive AE & Mocha Training in Singapore and Malaysia
    Adobe ACE/ACI (version 7) & Imagineer Systems Inc Approved Mocha Trainer

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