xxxxxxxxxx
79
let gorteskFont;
let fontSize = 550;
let firstLetter;
let secondLetter;
let x,y;
function preload() {
groteskFont = loadFont('https://cdn.glitch.com/5dd99b18-3ebb-45c5-90fb-b4b67dc2e128%2Fgrotesk.otf?v=1580943594863sk.otf');
}
function setup() {
createCanvas(400, 400);
textFont(groteskFont);
x = width*osc / 2*osc;
y = height*osc / 2*osc;
firstLetter = groteskFont.textToPoints("A", 40,380, fontSize, {
sampleFactor: 0.1
});
secondLetter = groteskFont.textToPoints("C", 40, 380, fontSize, {
sampleFactor:0.12
});
loop();
}
function draw() {
background(0,0,0,2);
beginShape();
fill(255, 184, 251);
noStroke(osc);
for (let i = 1; i < firstLetter.length; i++) {
vertex(firstLetter[i].x, firstLetter[i].y);
if (firstLetter[i].x < secondLetter[i].x) {
firstLetter[i].x++;
}
if (firstLetter[i].x > secondLetter[i].x) {
firstLetter[i].x--;
}
if (firstLetter[i].y > secondLetter[i].y) {
firstLetter[i].y--;
}
if (firstLetter[i].y < secondLetter[i].y) {
firstLetter[i].y++;
}
}
endShape(CLOSE);
}
function mousePressed(){
loop();
}
function osc(scale) {
if (!scale) {
scale = 10;
}
return abs(sin(frameCount * 100 * scale));
}