INNER CODE UNIT · JavaScript
arcShape
ren-yuan/c2.js · examples for p5.js/ArcField.js:26
let arcShape = new c2.Arc(width/2, height, width/2, PI, 2*PI);
let arcField = new c2.ArcField(arcShape, 1);
world.addForce(arcField);
}
function draw() {
background('#cccccc');
world.update();
for(let i=0; i<world.particles.length; i++){
let p = world.particles[i];
stroke('#333333');
strokeWeight(1);
fill(p.color);
circle(p.position.x, p.position.y, p.radius);
strokeWeight(2);
point(p.position.x, p.position.y);