xxxxxxxxxx
27
let a = []
let b = []
let c = []
let d = []
function setup() {
createCanvas(400, 400);
background(220);
strokeWeight(2);
stroke(0,255,255);
for (let i = 0; i < 100; i++) {
a.push(random(0,2 * PI))
b.push([-1,1][round(random(1))])
c.push(random(20,200))
d.push(createVector(200,200))
}
}
function draw() {
fill(0,0,0,5);
rect(0,0,width,height);
for (let i = 0; i < 100; i++) {
a[i] = a[i] + PI / 100 * b[i]
x = d[i].x + c[i] * cos(a[i])
y = d[i].x + c[i] * sin(a[i])
point(x,y)
}
}