xxxxxxxxxx
39
// Boolean to update or not update values
let following = true;
// Values
let x, y, sz;
function setup() {
createCanvas(400, 400);
x = // initial value
y = // initial value
z = // initial value
sz = // initial value
}
function draw() {
background(220);
if (frameCount % 180 == 0) {
following = !following;
}
if (following) {
// UPDATE THE SIZE AND POSITION OF SPHERE
// UPDATE SOUND VARIABLES
// In frame 179, x,y,z and sz get updated to these values:
x = 356;
y = 145;
z = 34;
sz = 50;
}
// In frame 180, following will flip to false and x,y,z,sz will remain the same
// DRAWING SPHERE
push();
translate(x, y, z);
sphere(sz);
pop();
}