ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Changing the sourceText in an expression

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Shane English
Changing the sourceText in an expression
on Aug 1, 2020 at 3:12:34 pm

I am using an expression that creates a great cursor type-on animation. Here is the code.

L = text.sourceText.length;
It = time - thisLayer.inPoint;
T = It*effect("Speed")("Slider");
F = Math.round( It%1);
if(F==1 | (T0)){Fl = "|";} else{Fl=" ";}
substr(0,T) + Fl;


I want to be able to drive the sourceText from a csv file but the above expression doesn't recognize the text form the data sheet and only uses what the original text in the layer. I've tried

verT = thisComp.layer("spreadsheet.csv")("Data")("Outline")("Result")("Result 0");

L = text.verT.length;
It = time - thisLayer.inPoint;
T = It*effect("Speed")("Slider");
F = Math.round( It%1);
if(F==1 | (T0)){Fl = "|";} else{Fl=" ";}
substr(0,T) + Fl;



and this clearly doesn't work.


Return to posts index

Filip Vandueren
Re: Changing the sourceText in an expression
on Aug 1, 2020 at 3:22:13 pm

Does it work if you change the first line ?

verT = thisComp.layer("spreadsheet.csv")("Data")("Outline")("Result")("Result 0").value;




Return to posts index

Shane English
Re: Changing the sourceText in an expression
on Aug 1, 2020 at 3:47:53 pm

that makes so much sense to me, but alas it did not work.

I went back and simplified the whole project that can be found here.
https://drive.google.com/drive/folders/1GQcKRgieBGTAV3vcWiIA5xOxKZaawrd7?us...

I updated the code to
verT = thisComp.layer("test_csv.csv")("Data")("Outline")("RIGHT TEXT")("RIGHT TEXT 0").value;

L = text.verT.length;
It = time - thisLayer.inPoint;
T = It*effect("Speed")("Slider");
F = Math.round( It%1);
if(F==1 | (T0)){Fl = "|";} else{Fl=" ";}
substr(0,T) + Fl;



Return to posts index


Filip Vandueren
Re: Changing the sourceText in an expression
on Aug 1, 2020 at 3:57:48 pm
Last Edited By Filip Vandueren on Aug 1, 2020 at 3:58:52 pm

This fixes it,

- in line 2 you were checking for the length of text.verT which doesn't exist,
- in the last line you were taking the .substr of nothing, which after effects would then try to apply to "value" -> again the wrong text.


verT = thisComp.layer("test_csv.csv")("Data")("Outline")("RIGHT TEXT")("RIGHT TEXT 0").value;

L = verT.length;
It = time - thisLayer.inPoint;
T = It*effect("Speed")("Slider");
F = Math.round( It%1);
if(F==1 | (T < L & T > 0)) {Fl = "|";} else{Fl=" ";}
verT.substr(0,T) + Fl;


If you plan on centering or right justifying the text, then the blinking cursor will change the width and so the layout will change along with the on/off of your cursor.
So better to always add the "|", and use a text-animator to blink the opacity of the last character.



Return to posts index

Shane English
Re: Changing the sourceText in an expression
on Aug 1, 2020 at 4:08:45 pm

Thank you so much!

Luckily I am only using this text with left justified work.


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2020 CreativeCOW.net All Rights Reserved
[TOP]