Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Offset blinking expression

  • Offset blinking expression

    Posted by Otávio Nascimento on December 14, 2023 at 7:58 pm

    I’m using a blinking expression inside an ‘else’, but it starts with a random value when it reaches the ‘else’. How to make the blinking start at zero? (I dont know the exact time that will reach the else).

    This is an example in the source text:

    var anyTime = 2.28;

    var cursorSpeed = 10;

    if (time < anyTime) {

    time;

    } else {

    var blinking = Math.abs(Math.sin(time * cursorSpeed));

    "blinking: " + blinking.toFixed(2)

    }

    Otávio Nascimento replied 2 years, 5 months ago 3 Members · 3 Replies
  • 3 Replies
  • Dan Ebberts

    December 14, 2023 at 8:06 pm

    Try changing this line:

    var blinking = Math.abs(Math.sin(time * cursorSpeed));

    to this:

    var blinking = Math.abs(Math.sin((time-anyTime) * cursorSpeed));
  • Hector Vera

    December 14, 2023 at 8:07 pm

    Is the var anytime equals to the total time of an animation equals 2.28 or is it the time where the blinking animation will start? I suggest screenshotting some of the issues you are having with it so we can better understand how we can help you out on this. For now I do have a video about ValueAtTime expression that may be able to help you a bit. Here it is below:

    https://www.youtube.com/watch?v=xFT6W9uSwbY

    Some contents or functionalities here are not available due to your cookie preferences!

    This happens because the functionality/content marked as “Google Youtube” uses cookies that you choosed to keep disabled. In order to view this content or use this functionality, please enable cookies: click here to open your cookie preferences.

  • Otávio Nascimento

    December 14, 2023 at 8:31 pm

    I tried something similar but it didn’t work.
    Here is the full expression in the opacity animator, so you can understand better:
    (‘startAnimationTime’ in the expression below is always zero, so the blinking still starts at a random value)

    var cursorSpeed = 10;
    var startAnimationTime = 0;
    // animation happening here
    if (thisLayer.name.length > text.sourceText.length) {
    startAnimationTime = time;
    100;
    } else { // animation ends here
    var elapsedTime = time - startAnimationTime;
    var blinking = Math.abs(Math.sin(elapsedTime * cursorSpeed));
    if (blinking < 0.5) {
    0;
    }
    else {
    100;
    }
    }

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