xxxxxxxxxx
36
let slide;
let y;
let drop = false;
function setup() {
createCanvas(400, 400);
slide = createSlider(15, width - 15, 0)
y = height / 2
}
function draw() {
background(0);
circle(slide.value(), y, 30)
slide.changed(d)
if (drop == true) {
y = y + 2
y = constrain(y, 0, height - 15)
} else {
y = height / 2
}
}
function d() {
drop = true
}