Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Link typewriting with blinking animation

  • Link typewriting with blinking animation

    Posted by Amstane Tindi on October 4, 2018 at 1:45 pm

    Hi,
    I’m trying to achieve an animation of an old typewriter, the one where text mouve to the left as you type. I designed a typewriter from pictures, and done the text animation. However I need to simulate an animation of the ribbon hitting the page every letter typed by making a layer (image of a ribbon guide) be visible only at the time when a new letter appear. But I can’t find a good way to do it.

    To do simple: I have extracted a value of the number of letters that it growing over time depending on the speed I set :(1,2,3,4…),
    Is there a way to link every “change” on this value (for exemple from 2 to 3) to an event : ribbon blink (go to 100 opacity then 0)
    something like :

    N=number of the character revealed,
    Each frame check if N is the same then N one frame ago, if true then 0 opacity, if false 100 opacity.

    Any Ideas?

    Will be very grateful.

    Kalleheikki Kannisto replied 7 years, 9 months ago 3 Members · 5 Replies
  • 5 Replies
  • Dan Ebberts

    October 4, 2018 at 5:28 pm

    It’s easier if you have a property where there is a keyframe corresponding to each change. If not, you can still do it, but it’s trickier.

    Dan

  • Kalleheikki Kannisto

    October 5, 2018 at 2:36 pm

    If you can pick whip the result value of N, you should be able to do it in this fashion for opacity:

    n0 = pick_whip_n_source_here;
    n1 = pick_whip_n_source_here.valueAtTime(time-thisComp.frameDuration);
    if(n0 != n1) 100 else 0

    If you can’t pick whip the values directly, you’ll have to calculate them for those two time values (current with no additional code and previous frame with the valueAtTime as per above).

    Kalleheikki Kannisto
    Senior Graphic Designer

  • Amstane Tindi

    October 7, 2018 at 12:17 pm

    Hi and thank you for your responses !
    I managed to do it with an idéa similar to yours with this code on the Opacity:
    s=thisComp.layer(“TITLE”).text.sourceText; //text
    L=s.length; //nomber of characters
    cf=thisComp.frameDuration;
    LX=(s.valueAtTime(time-cf)).length;// number of characters one image before.
    100* (L-LX)

    This way if the value is the same the opacity is 0, if it’s not which mean a new character was added the opacity is 100 and it goes back to 0 just after.

    But I’m wondering with your solution what is the ! after N0 ? in this line : if(n0 != n1) 100 else 0.

    Thanks again.

  • Amstane Tindi

    October 7, 2018 at 3:07 pm

    Thanks Dan,
    By the way, I am using your code for the type writing animation, thank you for that. But, is there a way to obtain the time of the end of the animation with a variation of this code?
    I need to know when the animation of typewriting will end depending of the number of character to enter.
    For exemple 20 characters = 100 frames.

    I need this because I want to trigger another animation at the end of the typing. And since there is no “timeAtValue” option that I can use, I thought about extracting this value from the source code of the animation.

    PS: I’m working on a template. that’s why I need this value.

    Thanks again.

    minRate = 3; // frames per character
    maxRate = 6;

    charCount = 0;
    t = 0;
    seedRandom(index,true);
    while (t < time){
    charCount++;
    t += framesToTime(random(minRate,maxRate));
    }
    value.substr(0,charCount)

  • Kalleheikki Kannisto

    October 9, 2018 at 4:43 pm

    != means “not equal to”

    Kalleheikki Kannisto
    Senior Graphic Designer

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