xxxxxxxxxx
26
function polar(cx, cy, angle, dist){
return {x:cx+cos(angle) * dist, y:cy+sin(angle) * dist}
}
function arrow(x, y, w, h, angle) {
beginShape()
let a = polar(x, y, angle-120, w)
let b = polar(x, y, angle+120, w)
let c = polar(x, y, angle, h)
vertex(a.x, a.y)
vertex(b.x, b.y)
vertex(c.x, c.y)
endShape(CLOSE)
}
function setup() {
createCanvas(400, 400);
angleMode(DEGREES)
}
let theta = 0
function draw(){
background(220);
arrow(200, 200, 30, 120, theta)
theta += 3
}