xxxxxxxxxx
59
// Interactive Typography, textToPoints() demo CRY, 2020
let grotesk;
let x, y;
let outlines = [];
function preload() {
grotesk = loadFont('Grotesk_Bold.otf');
}
function setup() {
createCanvas(400, 400);
textSize(150);
x = width/2 - 185;
y = height/2+40;
textFont(grotesk);
let moonPoints = grotesk.textToPoints('C R Y', x, y);
for (let i = 0; i < moonPoints.length; i++) {
let _moonPoints = moonPoints[i];
outlines[i] = new Outline(_moonPoints.x, _moonPoints.y);
}
}
function draw() {
background(0);
for (let i = 0; i < outlines.length; i++) {
outlines[i].show();
}
}
class Outline {
constructor(x, y) {
this.x = x;
this.y = y;
this.w = 18;
this.h = 55;
this.corner = 20;
this.r = 45;
}
show() {
push();
translate(this.x, this.y);
rotate(this.r);
this.r+=0.1;
stroke(255);
line(0,0,50,50);
pop();
}
}