Add typewriter text

This commit is contained in:
RedEnchilada 2016-05-15 15:29:28 -05:00
parent 651a142eac
commit 7f9c14b179

View file

@ -54,6 +54,25 @@ Renderer = (function() {
return txt; return txt;
} }
Renderer.typewriterText = function(text, x, y) {
var txt = Renderer.text("", x, y);
var spot = 0;
type();
return txt;
function type() {
spot++;
txt.text = text.substring(0, spot);
if (spot < text.length) {
window.setTimeout(type, 40);
}
}
}
Renderer.show = function(stage) { Renderer.show = function(stage) {
renderer.render(stage); renderer.render(stage);
} }