Activity › Forums › Adobe After Effects Expressions › Position of Comp to 'Offset' (or index) position of text animator
-
Position of Comp to 'Offset' (or index) position of text animator
Paul Ducco replied 3 years, 6 months ago 3 Members · 14 Replies
-
Paul Ducco
February 21, 2023 at 9:47 pmYou’re not wrong about this comment Filip…
There’s a lot of different moving parts and little expressions that don’ make a lot of sense on their own to control text-animators, so posting the code will be just confusing, but here’s the projectfile:
If you’re so inclined, would you be able to loosely explain what’s happening in the
– Character Value
– Range Selector: Mode; Amount;
expressions?
The Range Selector: Offset expression, I understand to be offsetting the offset. Oh the complexity!As an aside, I’ve rigged up some warnings for this usage, so that if values don’t match ‘0’ at the required time, there is some visual feedback. This is currently with a text layer that feeds the warning, within the cursor precomp (using Essential Graphics) to feedback the necessary info. Are there better/easier ways to do ‘alerts’?
-
Filip Vandueren
February 23, 2023 at 10:22 amHey Paul,
the entire setup is made so that we want to know the size of individual characters of the text.
There’s no built-in method to do this, you can only get the sourceRectAtTime() of the entire text-layer. But what if at certain points in Time, just one character is visible, then getting the sourceRect of the layer would be the sourceRect of that character.
Imagine that we would make a copy of our text layer and at time 1: character 1 is visibile, at time 2: character 2 is visible etc.
We would need a subtractive range selector from 0-1, animating its offset by “time”. That range should set all (non selected) characters’ scales to 0% (because setting the opacity to 0% does not remove characters from the bounding box rect).
That would work, but we would need a second copy of the layer. So why not do it in the same layer, but at a different time than we use visibly in the composition. We could do that at time +100000 seconds and suppose we’ll never use that part of the layer, or we could use negative time: layers and source of layers can perfectly exist before the start of out composition, so why not.
I choose -100 seconds as a starting point instead of 0, just as a buffer. (expression on offset)
So, if the time is not negative, and hence visible and used int he composition, the range scaling all the characters down should just be not be active (expression on amount switching it to 0). but it’s a subtractive range, so we have to change the mode to a ‘normal’ additive range when it’s not active (expression on mode switching between mode 2 and mode 1) otherwise everything would be “not not” selected and scaled
OK, so now we can examine the position, width and height of each individual character (at time -101 for character 1, -102 for character 2,…) , but we don’t want the cursor to be vertically aligned to the shape of each character, otherwise the cursor would be a few pixels lower when next to a “p” than when next to a “Á” character. So we use an extra text animator, to change all the characters to 1 uniform shape, again only in negative time, using the character value property, it will change ” sample text ” to ” xxxxx xxxx ” while keeping the kerning of the original, but it ignores spaces, which is why we need an epxression on sourceText to change regular spaces to special spaces which that animator does change into a character. Because otherwise, the sourceRect of ” ” is of course 0,0,0,0.
I hope that gives some insights
-
Paul Ducco
February 23, 2023 at 10:46 amAs always, really appreciate the knowledge share Filip! Thankyou
Reply to this Discussion! Login or Sign Up