Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Color blinking expression

  • Color blinking expression

    Posted by Patrick Murphy on April 28, 2016 at 8:28 pm

    Hello!

    I feel like this is a simple expression and I’ve tried writing it but with no luck.

    Basically, I’m trying to have a color fill in a shape layer blink between two colors.

    I have this expression for blinking but not sure how to apply it to color fill:

    blinkSpeed =30;
    n = Math.sin(time*blinkSpeed);
    if (n<=0) 0 else 150;

    My guess is that the “0” should be the first color information and the “else 150” part should be the other colors information?

    Any help is much much appreciated!

    Patrick Murphy replied 10 years ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    April 28, 2016 at 9:38 pm

    Your guess is correct. It would be like this for red and blue:

    blinkSpeed =30;
    n = Math.sin(time*blinkSpeed);
    if (n<=0) [1,0,0,1] else [0,0,1,1];

    Or, if you don’t want to use the normalized RGBA color channel values, you could do it like this:

    blinkSpeed =30;
    n = Math.sin(time*blinkSpeed);
    if (n<=0) [255,0,0,255]/255 else [0,0,255,255]/255;

    Dan

  • Patrick Murphy

    April 28, 2016 at 9:45 pm

    Thanks so much Dan!

    ( just submitted a tip for a coffee on me )

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