xxxxxxxxxx
37
// The Nature of Code
// Daniel Shiffman
// http://natureofcode.com
let angle = 0;
let avel = 0;
let aacc = 0;
function setup() {
createCanvas(640, 360);
}
// function mousePressed() {
// aacc = 0.1;
// }
function draw() {
aacc = map(mouseX, 0, width, -0.01, 0.01);
angle += avel;
avel = constrain(avel, -0.1,0.1);
avel += aacc;
aacc = 0;
background(255);
translate(width / 2, height / 2);
rotate(angle);
stroke(0);
strokeWeight(2);
fill(127);
line(-60, 0, 60, 0);
ellipse(60, 0, 16, 16);
ellipse(-60, 0, 16, 16);
}