Good day, Programmer:
I am looking to print out a series of strings, from an array, onto a canvas. Currently, it does not clear the canvas and prints all the text in a single iteration.
var test1 = ["This","is","a","test","to","see","if","it","really","works"];
function printWord(i){
setTimeout( function(){ ctx.fillText(test1[i], 150, 90) }, 1000 ) }
function clearScreen(){
ctx.clearRect(0, 0, 300, 100);
}
function playText(){
for(var i = 0; i < test1.length; i++){
clearScreen;
printWord(i);
};
}
playText();
Here is the JSFiddle. Updated link, thanks to Bigood for fixing the timing. Still require help with clearing the canvas.
Thank you,
LLCreatini