Copy link to clipboard
Copied
Hi,
I would like to use a slider to display a text (when the slider value is 0, the source text display nothing, when it is 10, the source text display the 10 first letters etc...). Like the Typewriter animation effect (but I need it with a Source Text expression)
I created a slider named "TextSlicer"
Wrote a text layer
And this expression in Source Text :
try
{
text.sourceText.split("")[Math.round(effect("TextSlicer")("Slider"))]
}
catch(err)
{text.sourceText }
With this expression, I can display one letter at time.
My goal would be to display N letters, based on the slider value :
text.sourceText.split("")[0] + text.sourceText.split("")[1] + text.sourceText.split("")[2] + text.sourceText.split("")
Thanks !
1 Correct answer
fullText = "blah blah";
numLetters = Math.floor(effect("TextSlicer")("Slider").value);
fullText.substr(0,numLetters);
You can also let the text constant, and add a Text Animator > opacity.
Xavier.
Copy link to clipboard
Copied
fullText = "blah blah";
numLetters = Math.floor(effect("TextSlicer")("Slider").value);
fullText.substr(0,numLetters);
You can also let the text constant, and add a Text Animator > opacity.
Xavier.
Copy link to clipboard
Copied
Thank you Xavier!
It works perfectly.
I just lost my Source Text attributes (different text sizes). I know this is a known behavior with Source Text, any idea for a workaround ?

