xxxxxxxxxx
127
let x = 0;
let speed;
let y = 0
let me = x;
let easing = 0.05;
let starX;
let starY;
let starSize;
let time = 100000;
function setup() {
createCanvas(windowWidth, windowHeight);
pixelDensity(1)
inhale()
}
function draw() {
// if (inhale == true){
// fill(10, 255, 255, x*0.1)
// noStroke()
// }
// else if (exhale == true){
// fill(0)
// noStroke()
// }
// else{
// fill(0)
// noStroke()
// }
circle(width / 2, height / 2, x)
x = x + speed
// wave ease - in
let targetY = x; // breathing input // also circle
let dy = targetY - me;
me += dy * easing;
// wave trail
noFill()
stroke(255)
strokeWeight(1) //10
point(0 + y, 200+me);
filter(BLUR, 3)
y = y + 0.1
// stars
let now = frameCount % 8
if (now == 0) {
drawStars();
} else {
}
}
// stars -- not even important
function drawStars() {
starX = random(0, width);
starY = random(0, height);
starSize = random(0.1, 0.5);
starXa = random(0, width);
starYa = random(0, height);
starSizea = random(0.2, 0.8);
starXb = random(0, width);
starYb = random(0, height);
starSizeb = random(0, 0.45);
ellipse(starX, starY, starSize);
ellipse(starXa, starYa, starSizea);
ellipse(starXb, starYb, starSizeb);
}
function inhale() {
clearTimeout(inhale, time);
speed = 1
setTimeout(pause, time);
console.log(speed)
}
function pause() {
clearTimeout(pause, time)
speed = 0
setTimeout(exhale, time);
console.log(speed)
}
function exhale() {
clearTimeout(exhale, time)
speed = -1
// speed = -speed
setTimeout(pause2, time);
console.log(speed)
}
function pause2() {
clearTimeout(pause2, time)
speed = 0
setTimeout(inhale, time);
console.log(speed)
}