xxxxxxxxxx
36
// The Nature of Code
// Daniel Shiffman
// http://natureofcode.com
let angle = 0;
let aVelocity = 0;
let aAcceleration = 0.0001;
let slider;
function setup() {
createCanvas(640, 360);
slider = createSlider(-0.01,0.01,0,0.001);
}
function draw() {
background(220);
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);
aAcceleration = slider.value();
angle += aVelocity;
aVelocity += aAcceleration;
}