xxxxxxxxxx
var word = "BIFROST"
var fontSize = 100;
var repulsionRadius = 100;
var font;
var particles = [];
function preload() {
font = loadFont("PIZZARIA.ttf");
}
function setup() {
createCanvas(windowWidth, windowHeight);
let textPositions = font.textToPoints(
word, 0, 0, fontSize,
{sampleFactor: 0.25, simplifyThreshold: 0});
let textBounds = font.textBounds(word, 0, 0, fontSize);
for (let position of textPositions) {
particles.push(new Particle(
random(width), -200,
position.x + width / 2 - textBounds.w * 0.5,
position.y + height / 2,
0.5));
}
}
function draw() {
background(50);
for (let i = 0; i < particles.length; i++) {
particles[i].move();
particles[i].display();
}
stroke(0, 50);
strokeWeight(repulsionRadius * 2);
}