xxxxxxxxxx
35
let str = "";
let p;
let words = [];
function preload() {
loadStrings("polaroid.txt", process);
}
function setup() {
noCanvas();
p = createP();
}
function draw() {
if (frameCount % 30 == 1) {
str += random(words) + '';
p.html(str);
}
}
function process(lines) {
console.log(lines);
for(let line of lines){
let tokens = splitTokens(line);
console.log('tokens',tokens)
words.push(tokens);
//for(let token of tokens ) words.push(tokens) //second way to do
}
}
for (let word of words){
word.trim();
word.toLowerCase();
}