How do I translate the following code into processing from pj.5s?
let y
let pins = []
////////////////////////////////////////////////////////////////////////////////////////////////////
OPC.slider("pins_num", 30, 1, 100)
OPC.slider("complexity", 3, 1, 10, 1)
OPC.slider("maximumHeight", 100, 10, 100)
parameterChanged = (variableName, value) => setup()
////////////////////////////////////////////////////////////////////////////////////////////////////
setup = () => {
createCanvas(windowWidth, windowHeight)
strokeWeight(.5)
y = 0
pins.length = 0
for (let i = 0; i < pins_num; i++) {
pins[i] = createVector(random(width), random(height))
}
}
draw = () => {
if (y < height) {
beginShape()
for (let x = 0; x < width; x++) {
angle = pins.reduce((sum, p) => sum + complexity * atan2(p.y - y, p.x - x), 0)
z = map(cos(angle), -1, 1, 0, maximumHeight)
vertex(x, y + z)
}
vertex(width, height)
vertex(0, height)
endShape(CLOSE)
y++
}
}