Track "typewriter" text to add blinking cursor.

Scripting for After Effects

Track "typewriter" text to add blinking cursor.

Postby Ampix0 on 04/22/2019, 1:03 pm

I am looking for a way to automate adding a blinking cursor where the next letter would go in text with the typewriter effect applied to it. I have a comp of a blinking cursor but I'm struggling to find a way to not only position it in the correct place but animating it at the same "framerate" as the text, the position changes rapidly, not in a smooth linear line from left to write, its one letter at a time with a small gap of time in-between.

I can possibly do some math to figure out the length of the string and the percentage in the range finder to emulate this? My next task is also making this something I could just "drag and drop" in the future.

Any thoughts?
Ampix0
 
Posts: 111
Joined: 05/13/2009, 6:23 pm

Re: Track "typewriter" text to add blinking cursor.

Postby Ampix0 on 04/22/2019, 1:54 pm

Well this script is damn near close enough to what I need when I add a single layer control to the object. Now like looking to make this more permanent.


Code: Select all
text_range = effect("Layer Control")("Layer").text.animator("Animator 1").selector("Range Selector 1").start;
text_width = effect("Layer Control")("Layer").sourceRectAtTime().width;
text_position = effect("Layer Control")("Layer").position;

this.position = [text_position[0] + (text_width * (text_range / 100)) + (this.sourceRectAtTime().width / 2) , text_position[1]]


This only works with single line text.
Ampix0
 
Posts: 111
Joined: 05/13/2009, 6:23 pm

Re: Track "typewriter" text to add blinking cursor.

Postby star+circle on 04/23/2019, 8:24 am

This ought to answer your question:

https://forums.creativecow.net/thread/227/40386
star+circle
 
Posts: 916
Joined: 12/6/2014, 3:07 pm
Location: Finland


Return to After Effects Expressions