Forum Discussion
Animated text
Something like this might work for a single field. Setup a variable called textInput and another for textOutput. Then set your textInput to the text you want to type. After that's setup, use a %textOutput% on your stage and call the following in a Javascript trigger.
This won't work locally. You'll need to either turn on local script execution for your browser or run it from a server. I haven't tested this. It's sort of off the top of my head. This will type at a varied speed if it works. Some characters will come quickly at the top speed (in ms) others will be about 80% slower.
Could get complicated for multiple fields but should work pretty well for a single field. JS is pretty snazzy for stuff like this. *Edit to take out the top and bottom from the randomizer. Didn't have the desired effect.
var player=GetPlayer();
var i = 0;
var txt = player.GetVar("textInput");
var speed = 400;
//clear text output so it starts with nothing
player.SetVar("textOutput","");
function typeWrite() {
textOutput=player.GetVar("textOutput");
var speedMod=speed*Math.random();
if (i < txt.length) {
textOutput+= txt.charAt(i);
player.SetVar("textOutput",textOutput);
i++;
setTimeout(typeWrite, speedMod);
}
}
typeWrite();
Related Content
- 8 months ago
- 10 months ago