xxxxxxxxxx
62
let font
function preload() {
font = loadFont('/EBGaramond-Regular.ttf')
}
function setup() {
createCanvas(710, 2900);
textFont(font);
textSize(14);
}
function draw() {
background(220);
// text variables
let beginning = "as ";
let ending = "a";
const phr = ['bowers hour in the sun', 'vying orbs make their pledge', 'some heedy alter of the core taken leaf', 'windy puddles predict the sun'];
let wordWidth = textWidth(beginning);
let margin = 10;
translate(margin, margin *4);
let b = 80;
for (let y=0; y < 100; y+= 1){
if (y <= 15){
text(beginning , 100, y * 20);
}
// looping array of const phr
//else if (y > 15 && y < 20){
//for (let i = 0; i < phr.length; i++){
// text(beginning , 100, y + i * 20);
//}
else if
(y <=41){
text(beginning, 100, y * 20);
}
else if(y<=60){
text(beginning + ending, 100, y * 20);
}
}
for (let i = 0; i < phr. length; i++){
text(phr[i], 100 + wordWidth, b + i * 20);
}
}