Last active
May 21, 2022 13:36
-
-
Save gordielachance/122dbac205c4c422a2590d7a6177b9be to your computer and use it in GitHub Desktop.
After Effects Expression : Reveal text (TypeOn + blinking cursor)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//put this expression for the 'Source Text' value on your text layer, and add 4 markers on the layer : 'cursorStart', 'textStart', 'textStop', 'cursorStop' | |
cursor="|"; | |
cursorBlink = 1; //seconds | |
txt = value; | |
timeIn = thisLayer.inPoint; //seconds | |
txtSize = text.sourceText.length; | |
animateText = true; | |
showCursor = true; | |
//check if required markers exists | |
try{ | |
textStart = marker.key('textStart').time; | |
textStop = marker.key('textStop').time; | |
}catch(e){ | |
AnimateText = false; | |
} | |
//check if required markers exists | |
try{ | |
cursorStart = marker.key('cursorStart').time; | |
cursorStop = marker.key('cursorStop').time; | |
}catch(e){ | |
showCursor = false; | |
} | |
if (animateText){ | |
duration = textStop - textStart; //type-on duration in seconds | |
txtIdx = linear(time, textStart, textStop, 0, txtSize); | |
txt = substr(0,txtIdx) | |
} | |
if (showCursor){ | |
F = Math.round( (time + cursorStart) % cursorBlink ); | |
if ( (time > cursorStart) && (time < cursorStop) && (F==1) ) { | |
txt += cursor; | |
} | |
} | |
txt; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
...Or with a slider 'txtComplete' (0 to 100 percent) that you can use to animate the text progression :