I have a code with constructor for each letter of the alphabet. so if i say new A (x,y,w,h) I can create a new A which will draw itself on the canvas. Is there a way to automate this process in passing a string to a function which will draw each letter of the string individually? (working with P5.js )
I get the error "characters[i] is not a constructor".
thank you
function createword(str) {
str.toUpperCase();
var characters = str.split('');
console.log(characters)
var space = 0
for (let i = 0; i < characters.length; i++) {
word[i] = new characters[i](space, 0, 100, 100)
space += 100
// word.push(characters[i])
}
for (let i = 0; i < word.length; i++) {
word[i].setuplettre()
word[i].drawlettre()
}
console.log(word)
}