Typewriter effect in Hype

Here is a simple Javascript that seems to work ok.

I just wrote it so it is what it is… for now. :smile:

 	var charArray = "Here is some text to type out\n And this is a second line.".split('');
	var textElement = hypeDocument.getElementById('text');
	var counter;
	var i=0;

  var thisFire =   setInterval(function(){
	 
	 if (i == charArray.length){
	 clearInterval( thisFire);
	  return;
	 }
     var charItem = charArray[i];
 
	 textElement.innerHTML =  textElement.innerHTML + charItem;
 
  		i++;
	
	 }, 200);

In this project this Javascript is run on scene load.

type text.hypetemplate.zip (10.6 KB)

3 Likes