xxxxxxxxxx
125
let x = 0;
let speed;
let y = 0
let me = x;
let c = x
let fa = 1;
let f;
let k;
let pace = 2
let easing = 0.05;
let starX;
let starY;
let starSize;
let time = 1000;
function setup() {
createCanvas(windowWidth, windowHeight);
pixelDensity(1)
inhale()
frameRate(100)
f = 0;
}
function draw() {
stroke(255, 255, 255, (speed + 1) * 10)
strokeWeight(3)
noFill()
circle(width / 2, height / 2, x)
x = x + speed
//console.log(frameRate())
// 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)
// darker wave point
stroke(255)
strokeWeight(3)
point(0 + y, 200+me);
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() {
setTimeout(inhale, time);
speed = 1
speed = speed
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)
}