Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions How to get a Blinking Effect using expressions?

  • How to get a Blinking Effect using expressions?

    Posted by James Ceguerra on January 2, 2011 at 5:15 pm

    Hello everyone, Random person here.
    Question:
    I have a image of a light, sorta like a LED. I want it to blink to a song’s BPM, my plan to do this was to use audacity to generate the bpm, figure out the time between each beat and set opacity keyframes and then make it loop.
    I managed to get all that done except for the loop part…
    i tried searching online for ‘blinking in after effects’ and i found some stuff that i couldn’t understand except something about expressions?
    I managed to find one expression however I have no idea how to determine the timer for it…
    the expression is
    blinkSpeed = 1;
    lowOpacity = 10.0;
    highOpacity = 90.0;
    opNormal = (Math.cos(blinkSpeed*time*Math.PI*2)+1)/2;
    linear(opNormal,0,1,lowOpacity,highOpacity);
    and found it here
    https://video.ucf.edu/knowledge/reference/pdf/adobe/aft6blink.pdf
    Can I get some help please?

    Dan Ebberts replied 14 years, 9 months ago 3 Members · 16 Replies
  • 16 Replies
  • Dan Ebberts

    January 2, 2011 at 6:14 pm

    I think you’d just need to change the first line to convert your bpm value to frequency, like this:

    blinkSpeed = your_bpm_value/60;

    Dan

  • James Ceguerra

    January 5, 2011 at 6:32 pm

    Thanks for the help 🙂

  • Jack Cloud

    August 14, 2011 at 10:58 pm

    Need a blink expression that can control a layers opacity from a nested comp.

    Is there a way that a short nested “BLINK” comp can have an expression on it so that wherever it appears in the timeline ANOTHER LAYER’S Opacity is changed from 100% to 0% and the start of the nested comp and then back to 100% at the end of the nested comps duration within the main comp? In effect, I can then drop copies of the 6 frame “Blink” nested comp anywhere along the time line and it will drive an “eyelash” layer’s opacity?

    cheers

  • Dan Ebberts

    August 15, 2011 at 12:19 am

    Assuming your BLINK subcomp is a layer in the comp with the eyelash layer, you would apply something like this to the eyelash layer’s opacity:

    blink = thisComp.layer(“BLINK”);
    time < blink.inPoint || time > blink.outPoint ? 100 : 0

    Dan

  • Jack Cloud

    August 15, 2011 at 4:09 pm

    Hi Dan,
    thanks so much for that. I applied the expression and it returned this error.
    Expression was applied to “eyelash” layer’s Opacity:

    blink = thisComp.layer(“blink 2”).transform.opacity;
    time < blink.inPoint || time > blink.outPoint ? 100 : 0

    and returned error was:
    Warning: Class ‘Property’ has no property or method named ‘inPoint’.
    Expression disabled
    Error occurred in line 2.

    Now I applied another expression like this;

    op = thisComp.layer(“blink”).transform.opacity;

    100 – op

    AND it worked as long as I keyed the ‘Blink’ layer’s Opacity

    I’d like to try and get yours to work because it seems that expression functions from the subcomp’s mere appearance in the timeline regardless of any keyframes AND I’ll have many occurrences of the “Blink” layer duplicated anytime I want the character to blink.

    Thanks again for your help. You’re a genius Dan
    best,
    Jack

    blink = thisComp.layer("blink 2").transform.opacity;
    time &lt; blink.inPoint || time > blink.outPoint ? 100 : 0

    OR

    op = thisComp.layer("blink").transform.opacity;

    100 - op

    cheers

  • Jack Cloud

    August 15, 2011 at 4:23 pm

    I also noted that if I use the:

    op = thisComp.layer(“blink”).transform.opacity;

    100 – op

    expression the eyelash layer will ONLY look at the 1st layer in heirarchy to do the opacity change. All other instances of “Blink” subComp have no effect. Oh boy.

    cheers

  • Dan Ebberts

    August 15, 2011 at 4:25 pm

    Hmmm… The expression I posted was for the eyelash layer’s opacity, not the blink layer. I apologize if you already know this, but an expression can only affect the property it’s applied to. So you can’t have an expression in one layer affect opacity in another layer. The expression I posted should (although I didn’t test it) make the eyelash layer invisible between the in and out points of the blink layer.

    Dan

  • Jack Cloud

    August 15, 2011 at 4:36 pm

    Hi Dan,
    my bad. I applied the expression to the correct “eyelash” layer Opacity BUT pickwhipped it to the “Blink” layer Opacity rather than the layer itself. All good now!

    However
    Any thoughts on how to do this with 10 or 20 instances of the “blink” layer in the timeline?

    Thanks again sir Dan

    cheers

  • Dan Ebberts

    August 15, 2011 at 4:55 pm

    If the layers are contiguous, you could use relative indexing from the first (topmost) instance, like this to get at the 5th instance, for example:

    thisComp.layer(thisComp.layer(“Blink”),4).inPoint

    Dan

  • Jack Cloud

    August 15, 2011 at 5:33 pm

    Ah huh, does this look right to you?
    Im only getting it to read the last instance now. I thought it’d be simple sorry to bug you with it, but of course this animation is sitting here waiting on me in the studio.

    cheers

Page 1 of 2

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