xxxxxxxxxx
34
let font;
function preload() {
font = loadFont('GraphikBlack.otf');
}
function setup() {
createCanvas(800, 800);
textFont(font);
}
function draw() {
background(220);
for (let y = 0; y <= height; y += 50) {
for (let x = 0; x <= width; x += 50) {
// distance between mouse and x and y
let d = dist(x, y, mouseX, mouseY);
// map d from 200 - 0 to 5 - 30
let ts = map(d, 200, 0, 5, 100);
// constrain ts so it never goes negative
ts = constrain(ts, 5, 130);
// set the size and draw the char
textSize(ts);
text('BC', x, y);
}
}
}