const string = "Plantasia";
const fontFile = "FleuronRegular.otf";
const backgroundColorRed = 161;
const backgroundColorGreen = 219;
const backgroundColorBlue = 178;
const strokeColorRed = 43;
const strokeColorGreen = 64;
const strokeColorBlue = 11;
const fontSampleFactor = 2;
const noiseFalloff = 0.5;
const individualZOffset = 0;
const newPointsCount = 9;
font = loadFont(fontFile);
createCanvas(windowWidth, 768);
background(backgroundColorRed, backgroundColorGreen, backgroundColorBlue);
fill(backgroundColorRed, backgroundColorGreen, backgroundColorBlue, textAlpha);
stroke(strokeColorRed, strokeColorGreen, strokeColorBlue, 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(strokeColorRed, strokeColorGreen, strokeColorBlue, 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;