const path = document.getElementById("path")
const pathLength = Math.floor(path.getTotalLength())
const pathWidth = path.getBoundingClientRect().width
const pathHeight = path.getBoundingClientRect().height
const l = Math.max(pathWidth, pathHeight)
createCanvas((w = 600), (h = 600))
translate(-w / 2, -h / 2)
let sclY = pathHeight * (sclX / pathWidth)
translate((w - sclX) / 2, (h - sclY) / 2)
for (let i = 0; i <= 100; i += 1 / (n / 100)) {
function shapeAtPercent(percent, scl) {
let currLen = (percent * pathLength) / 100
pt = path.getPointAtLength(currLen)
let x = (Math.round(pt.x) / l) * scl
let y = (Math.round(pt.y) / l) * scl
function drawShape(x, y) {
let y1 = y - random(3, 10)
let y2 = y + random(3, 10)
let rightOff = random(20000)
let leftOff = random(20000)
let noiseInc = random(0.01, 0.03)
let step = w / random(1000, 2000)
let lightOff = random(-10, 10)
for (let i = 0; i < d; i += step) {
let x1 = x - noise(rightOff) * (maxWidth / 2)
let x2 = x + noise(leftOff) * (maxWidth / 2)
stroke(28, 28, 88 + lightOff)
line(x1, y1 + i, x2, y1 + i)
function gorillaGrain(gA) {
let halfImage = 4 * (width * d) * (height * d)
for (let i = 0; i < halfImage; i += 4) {
grainAmount = map(random(), 0, 1, -gA, gA)
pixels[i] = pixels[i] + gA / 2
pixels[i + 1] = pixels[i + 1] + grainAmount
pixels[i + 2] = pixels[i + 2] + grainAmount
pixels[i + 3] = pixels[i + 3] + grainAmount