Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions A way to type-on from the RIGHT?

  • A way to type-on from the RIGHT?

    Posted by Lu Nelson on May 29, 2008 at 8:29 am

    OK, I think one or the other of the expressions experts here can probably answer this quite quickly.

    I want to modify a simple “Type-On” (or more precisely “Word Processor”) effect so that:

    rather than the text being stationary while the selector moves along to reveal the text, we keep the ‘insertion point’ stationary and have the text flow away (to the left) — rather like typing your text in a Word Processor when the paragraph is right-aligned.

    Some of AE CS3’s presets like “Insertion Point” and “Stack Left Stack Right” seem to be going in the right direction for this but they are only approximations, offsetting based on percentage of range, and an arbitrary position value. Not enough to make the effect look right, especially if you have a flashing “insertion point/cursor” at the selector, as in the built-in (left-aligned) “Word Processor” effect.

    Is this actually possible?

    I have the impression from other posts I’ve read here that because it seems neither possible to 1. get the *actual* position of the selector at any point of time, nor 2. return the actual height or width of the text layer, let alone individual lines, that there may be no possible method for offsetting position precisely.

    Thanks for any comments,

    LMN

    Lu Nelson replied 17 years, 10 months ago 2 Members · 10 Replies
  • 10 Replies
  • Kevin Camp

    May 29, 2008 at 6:37 pm

    this seems to work:

    delay = 5; // duration in frames before next charecter
    (value).substr(0,time/(thisComp.frameDuration*delay)+1)

    if the layer is right justified it will type in from the right (starting with the first character), if it is left it wiil start typing in from the left…

    it should take the ‘value’ of the text layer (whatever you’ve typed), and start typing it in at from the inpoint of the layer. it will start at the first letter and keep adding letters to the right until the text sting is finished.

    you can use the ‘delay’ variable to set how fast the type on effect happens.

    Kevin Camp
    Senior Designer
    KCPQ, KMYQ & KRCW

  • Kevin Camp

    May 29, 2008 at 6:48 pm

    i didn’t mention this, but paste the expression into the expression field for source text..

    Kevin Camp
    Senior Designer
    KCPQ, KMYQ & KRCW

  • Lu Nelson

    May 30, 2008 at 7:36 am

    Wow — thanks, that’s of course a different way of thinking of it and much more flexible.

    It seems it would also be easy to randomize the delay number a bit, to make things a bit more realistic looking WRT the way people actually type.

    I have to see now how I will combine this with the method for having a flashing cursor.

    Also: any suggestion on how one could control the progress of the typing?
    Stopping at certain points (after a group of words e.g.) and then continuing?

    Thanks again for your help!

    Lu Nelson
    Berlin, Germany

  • Lu Nelson

    May 30, 2008 at 7:40 am

    Mmm I thought about the last part of that post a bit and realized it might be rather easy:

    just with an expression control somewhere else that would allow you to toggle between the normal delay value and an extremely large one like 300 or so, essentially causing the typing to stop at points and then continue.

    Still interested if you have a better suggestion though…

    LMN

    Lu Nelson
    Berlin, Germany

  • Kevin Camp

    May 30, 2008 at 6:08 pm

    this seems like it may be the easiest way to get a very natural type-on feel.

    if (marker.numKeys > 0){
    n = marker.nearestKey(time).index;
    (value).substr(0,n-1)
    }else{
    value
    }

    all you have to do is enter the type, add the expression, then, with the layer selected do a ram preview and as the ram preview starts playing just hit the ‘*’ on the numbers pad to add layer markers as you want the characters to start typing on. you’ll be adding them in realtime, so the type rate should feel very natural. once you’ve added them all, do another ram preview and the letters should type on at the rate that you added markers. you can make tweaks by adjusting the markers, or start over by clearing them.

    Kevin Camp
    Senior Designer
    KCPQ, KMYQ & KRCW

  • Kevin Camp

    May 30, 2008 at 6:34 pm

    this one is slightly better:

    if (marker.numKeys > 0){
    for (n=1; time>=marker.key(n).time; n++);
    (value).substr(0,n-1)
    }else{
    value
    }

    the previous one was using the nearestKey function which would make the letter add at points in between the markers… this version will type the letters on the keys. it’s a little easier to know when they will start typing this way.

    Kevin Camp
    Senior Designer
    KCPQ, KMYQ & KRCW

  • Kevin Camp

    May 30, 2008 at 6:45 pm

    oops, i got an error at the end if there wasn’t a marker at the end of the layer. one minor change fixes that:

    if (marker.numKeys > 0){
    for (n=1; time>=marker.key(n).time && n marker.numKeys) value;
    }else{
    value
    }

    Kevin Camp
    Senior Designer
    KCPQ, KMYQ & KRCW

  • Kevin Camp

    May 30, 2008 at 6:51 pm

    ooops again, i had one line of code that wasn’t needed (it still worked, but we might as well keep it simple)… here is the final one:

    if (marker.numKeys > 0){
    for (n=1; time>=marker.key(n).time && n

    let me know how this works…

    Kevin Camp
    Senior Designer
    KCPQ, KMYQ & KRCW

  • Kevin Camp

    May 30, 2008 at 6:54 pm

    ok, i’m loosing part of my code… let’s try this:

    if (marker.numKeys > 0){
    for (n=1; time>=marker.key(n).time && marker.numKeys>n; n++);
    (value).substr(0,n-1)
    }else{
    value
    }

    Kevin Camp
    Senior Designer
    KCPQ, KMYQ & KRCW

  • Lu Nelson

    July 15, 2008 at 6:34 pm

    Thanks Kevin!

    Lu Nelson
    Berlin, Germany

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