Type on - Not typewriter

New Hype user, basically trying to duplicate some of the functionality that Adobe Director used to provide before it's untimely demise.
Is there a way to simulate a typewriter effect BUT where a letter is revealed every time the user presses a key on the keyboard (any key).
I've read the thread about the typewriter effect - very cool, but I need to be able to control the reveal of the letters based on the actual clicking on a keyboard (Ideally without animating a graphic element covering the letters).
Any pointers would be greatly appreciated

How about...

Run on scene loaded:

 var wordToType = 'deoxyribonucleic acid'; // word to be 'uncovered'
	var txtLength = wordToType.length;
	var typeCount = 1; // start with the first letter
	var output = document.querySelector ('.display'); // get the text output by class
	
	document.onkeypress=function(e){

		if (typeCount <= txtLength) {
	//set innerHTML of textoutput to word uncovered so far + current letter
			output.innerHTML = wordToType.slice(0,typeCount);
			typeCount++; // next letter
		
		} else {
		

			hypeDocument.startTimelineNamed('solved', hypeDocument.kDirectionForward) // word uncovered, start timeline 'solved' (or do anything you want to do...)
		}

}

type.hype.zip (12.9 KB)

5 Likes

The Type Text extension which stemmed from the typewriter thread has auto type or per key press options.

2 Likes

That works perfectly - thanks for the help!

1 Like

Didn't see that at first in that thread - thanks for pointing that out - I appreciate it