Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Expression for Not fluid interpolation

  • Expression for Not fluid interpolation

    Posted by Guido Giardino on February 10, 2010 at 2:14 pm

    I am animating an old typewriter. I’m trying to solve how to make the drum or barrel of the typewriter moving progress while the letters goes typing. The animation of the points I made with the preset “Typewriter”.

    I think the expression i need is one that neutralizes the interpolation of the position of the barrel and simulates “hold keyframes” showing only the frames whenever the property “Start” of the Range Selector text increase X number of its percentage.

    Example: I want the typewriter type “Hello friends, how are you?”. For this case one letter reveals whenever the property “start” increases in 4 (%). And the barrel moves along the X axis from 347 to -399. What I need is that the route of 347 to -399, interpolation move like it was hold frame keyed, any time the range selector increase 4 points.

    I was trying with the following code but does not work, is not doing anything!

    x_position = linear (comp ( "replacement text.") layer ( "Hello friends, how are you?"). text.animator ( "Animator 1"). selector ( "Range Selector 1"). start, 0, 100, 347 , -399);
    y_position = (-639);

    [x_position, y_position]

    I suppose this is so hard to do as to explain it! Hopefully someone can help me!

    Sorry my bad english!

    x_position = linear (comp ( "replacement text.") layer ( "Hello friends, how are you?"). text.animator ( "Animator 1"). selector ( "Range Selector 1"). start, 0, 100, 347 , -399);
    y_position = (-639);

    [x_position, y_position]

    Chiekh Benaissa replied 16 years, 3 months ago 4 Members · 6 Replies
  • 6 Replies
  • Kevin Camp

    February 10, 2010 at 4:31 pm

    since you have linear interpolation, you might be able to add posterizeTime(1) at the beginning of your expression. it essentially sets the frame rate of the interpolation (in fps) to create a stop-frame-like animation style similar to hold keyframes. you’d need to play with the value in () to find the fps that works for your comp.

    however, it may be easier if you set the typewriter preset to use index values rather than percentages and use that as a multiplier to move the barrel. you’ll find this setting in animator 1>range selector 1>advanced, change units from percentage to index. then try an expression like this:

    target = thisComp.layer(“hello friends, how are you”); // select you text layer here
    offset = 26.6; // set your per character offset here (the width of a character)
    x = value[0] + (offset * Math.round(target.text.animator(“Animator 1”).selector(“Range Selector 1”).start));
    [x, value[1]]

    position the barrel layer where it need to start and the expression will add the offset value to the x position every time a letter types on. it will take some fiddling around to get the offset value right, but it should work from there. note, this requires that you are using a fixed width font, like most old typewriters used.

    Kevin Camp
    Senior Designer
    KCPQ, KMYQ & KRCW

  • Dan Ebberts

    February 10, 2010 at 4:38 pm

    Like this maybe:

    range = comp(“replacement text”).layer(“Hello friends, how are you?”).text.animator(“Animator 1”).selector(“Range Selector 1”).start;
    r = Math.floor(range/4)*4;
    x = linear(r,0,100,347,-399);
    [x,-639]

    Dan

  • Guido Giardino

    February 10, 2010 at 5:55 pm

    Thank you very much Dan! You’re a genius! could I rent your brain?

    Rather, I do not know if it’s too much trouble for you to explain me how it is working!

    Thanks again!

  • Guido Giardino

    February 10, 2010 at 5:59 pm

    Thanks for your reply Kevin. I could not try your solution because I tried Dan`s solution first and it worked … If I test it later I will let you know!

    Thank you very much!

  • Dan Ebberts

    February 10, 2010 at 6:49 pm

    The key is this line:

    r = Math.floor(range/4)*4;

    which holds the value of “r” to the most recent value of “range” which is evenly divisible by 4.

    Dan

  • Chiekh Benaissa

    February 11, 2010 at 1:02 pm

    Thanks

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