xxxxxxxxxx
53
let poem = ["She is near", "She is late", "I hear", "I wait"]
let c1, c2;
function preload() {
fontA = loadFont('at-light.ttf');
fontB = loadFont('at.ttf');
fontC = loadFont('Akz-light.otf');
}
function setup() {
createCanvas(400, 600);
blendMode(SCREEN);
angleMode(DEGREES);
c1 = color(255, 0, 0);
c2 = color(255, 204, 102);
for (let y = 0; y < height; y++) {
n = map(y, 0, height, 0, 1);
let newc = lerpColor(c1, c2, n);
stroke(newc);
line(0, y, width, y);
}
}
function draw() {
noLoop();
noStroke();
//She is near, she is near.
sentence(poem[0], 255, fontA, 30, 40, 80);
sentence(poem[0], 255, fontA, 42, 40, 120);
//She is late.
sentence(poem[1], 255, fontA, 24, 240, 240);
//I hear, i hear.
sentence(poem[2], 255, fontA, 60, 40, 360);
sentence(poem[2], 255, fontA, 100, 40, 440);
//I wait.
sentence(poem[3], 255, fontB, 18, 310, 560);
push();
rotate(90);
translate(10,-4);
sentence('FROM MAUD (PART I), BY ALFRED TENNYSON', 160, fontC, 8, 0, 0);
pop();
function sentence(content, color, font, size, x, y) {
fill(color);
textFont(font);
textSize(size);
text(content, x, y);
}
}