xxxxxxxxxx
46
let pos;
let vel;
let acc;
let a = 0;
function setup() {
createCanvas(windowWidth, windowHeight);
colorMode(HSB);
pos = createVector(width/2, height/2);
vel = p5.Vector.random2D();
vel.mult(random(10));
}
function draw() {
background(0, 0, 0); //HSB alpha is floating number between 0.0 - 1.0
let mouse = createVector(mouseX, mouseY);
acc = p5.Vector.sub(mouse, pos);
acc.setMag(1);
// translate(width/2, height/2);
vel.add(acc);
vel.limit(5);
pos.add(vel);
circle(pos.x, pos.y, 20);
// let n = map(noise(pos.x, pos.y), 0, 1, 50, 100)
// pos.add(mouse);
// strokeWeight(n/10);
// stroke(random(0, 360), 100, 50);
// line(0, 0, v.x, v.y);
// push();
// rotate(a);
// beginShape(LINES);
// vertex(pos.x, pos.y);
// vertex(pos.x*5, pos.y*-5);
// a += 10
// endShape();
// pop();
}