const string = "CAN YOU READ ME?";
const fontFile = "Muli-Black.ttf";
const backgroundColor = 0;
const fontSampleFactor = 0.2;
const noiseFalloff = 0.4;
const individualZOffset = 0;
const newPointsCount = 9;
font = loadFont(fontFile);
createCanvas(windowWidth, 1080);
background(backgroundColor);
fill(backgroundColor, textAlpha);
stroke(strokeColor, strokeAlpha);
noiseDetail(noiseOctaves, noiseFalloff);
startingPoints = font.textToPoints(string, width / 2 - textWidth(string) / 2, height / 2, size, {"sampleFactor": fontSampleFactor});
for (let p = 0; p < startingPoints.length; p++) {
points[p] = startingPoints[p];
points[p].zOffset = random();
text(string, width / 2 - textWidth(string) / 2, height);
stroke(strokeColor, strokeAlpha);
for (let pt = 0; pt < points.length; pt++) {
let noiseX = p.x * noiseZoom;
let noiseY = p.y * noiseZoom;
let noiseZ = frameCount * zOffsetChange + p.zOffset*individualZOffset;
let newPX = p.x + map(noise(noiseX, noiseY, noiseZ), 0, 1, -lineSpeed, lineSpeed);
let newPY = p.y + map(noise(noiseX, noiseY, noiseZ + 214), 0, 1, -lineSpeed, lineSpeed);
line(p.x, p.y, newPX, newPY);
function mouseDragged() {
for (let i = 0; i < newPointsCount; i++) {
let magnitude = randomGaussian() * ((newPointsCount-1)**0.5*3);
"x": mouseX + magnitude * cos(angle),
"y": mouseY + magnitude * sin(angle),
points[points.length] = newPoint;
startingPoints[startingPoints.length] = newPoint;