Created
August 18, 2020 15:30
-
-
Save Juriy/54e22a9209e7eef40664420f7e6c93ba to your computer and use it in GitHub Desktop.
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
// typewriter effect | |
// After Effects script | |
// based on work of @MotionHub and @Wesley Wiyadi | |
// set this variables to configure | |
const blinkSpeed = 2; // times per second | |
const speed = 15; // how fast characters will appear | |
const startAt = 0; // delay to start an effect | |
const cursorCharacter = '|'; // character to use as a cursor | |
const str = text.sourceText; | |
const cursorVisible = Math.round(time*blinkSpeed) % 2; | |
const cursor = cursorVisible ? ' ' : ; | |
const numCharacters = Math.floor(time * speed - startAt * speed); | |
numCharacters > 0 ? str.substr(0, numCharacters) + cursor : cursor; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment