'Typewriter effect P5.JS
js and trying to animate a text for it to look as if it was being typed, but I am stuck with this...
var palabra= "Hola!"; =
var pos = 0;
function setup() {
  createCanvas(canvasWH, canvasWH);
  frameRate(10); 
}
function draw() {  
  textFont('Georgia');
  textSize(20);
  
  text(palabra.substring(pos, pos + 1), pos+++, canvasWH/2, canvasWH, 100);
  pos = +++
  // Check if we are at the end to restart animation
  if () {
  //restart animation
  }
}```
							
						Solution 1:[1]
pos++ is the way to increment.
restartDelay controls how many frames to wait before clearing after drawing is complete
var palabra= "Hola!";
var pos = 0;
var restartDelay = 5;
function setup() {
  createCanvas(500, 500);
  frameRate(10); 
}
function draw() {  
  background(255);
  textFont('Georgia');
  textSize(20);
  
  text(palabra.substring(0, pos + 1), 50, 50);
  pos++;
  // Check if we are at the end to restart animation
  if (pos > palabra.length + restartDelay) {
  //restart animation
    pos = 0;
    
  }
}
    					Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source | 
|---|---|
| Solution 1 | Samathingamajig | 
