sketch = p => {
const h = 600
const edge = 2
let mouse
p.setup = () => {
p.createCanvas(width, h)
}
p.draw = () => {
p.background(13,15,5)
const pos = p.createVector(width / 2, h / 2)
if (p.mouseX <= edge || p.mouseX >= width - edge || p.mouseY <= edge || p.mouseY >= h - edge ) {
mouse = p.createVector(p.random(1, width), p.random(1, h))
} else {
mouse = p.createVector(p.mouseX, p.mouseY)
}
const v = p5.Vector.sub(mouse, pos)
v.setMag(h/3)
p.translate(width / 2, h / 2)
p.stroke(61, 189, 93)
p.strokeWeight(8)
p.line(0, 0, v.x, v.y)
p.noStroke()
p.fill(13,15,5)
p.ellipse(0, 0, 4)
}
}