xxxxxxxxxx
81
let x = 20;
let speed;
let ac = 0.1;
let y = 0
function setup() {
createCanvas(710, 400);
background(0);
// noStroke();
// noFill()
ellipseMode(RADIUS);
inhale()
}
function draw() {
// background(0);
drawGradient(width / 2, height / 2);
point(height/2+y, x)
y = y+0.1
}
function drawGradient(f, y) {
let h = 0;
for (let r = x; r > 0; --r) {
// strokeWeight(10)
// fill(255, 255, 255, h);
noFill()
stroke(255+h, 255+h, 255+h, h-4)
strokeWeight(10)
ellipse(f, y, r, r);
h = h + 0.2
}
x = x + speed
}
function inhale() {
setTimeout(inhale, 2000);
speed = 1
speed = speed
ac++
setTimeout(pause, 2000);
console.log(speed)
}
function pause() {
clearTimeout(pause, 2000)
speed = 0.01
speed = speed
ac = 0
setTimeout(exhale, 2000);
console.log(speed)
}
function exhale() {
clearTimeout(exhale, 2000)
speed = 1
speed = -speed
ac = -(ac++)
setTimeout(pause2, 2000);
console.log(speed)
}
function pause2() {
clearTimeout(pause2, 2000)
speed = 0.01
speed = -speed
ac = 0
setTimeout(inhale, 2000);
console.log(speed)
}