xxxxxxxxxx
137
let x=20;
let speed;
let y = 0
let me = x;
let easing = 0.05;
let starX;
let starY;
let starSize;
let time = 7000;
let time2 = 2000;
let time3 = 1000;
function setup() {
createCanvas(windowWidth, windowHeight);
inhale()
frameRate(100)
}
function draw() {
background(0)
for (let a =1; a<=100; a++){
let c = map(a, 1, 100, 100, 0)
let b = x -a
let d = x+a
if (b<=0){
b=0
}
else{
b = x-a
}
strokeWeight(1)
stroke(255, 255, 255,2)
circle(width / 2, height / 2, x)
stroke(255, 255, 255, c)
circle(width / 2, height / 2, d)
stroke(255, 255, 255, c)
circle(width / 2, height / 2, b)
}
x = x + speed
//x = constrain(x, 0, 10000)
console.log(x)
// wave ease - in
let op = map(x, 10, 230, height-5, height-100)
let targetY = op; // breathing input // also circle
let dy = targetY - me;
me += dy * easing;
// wave trail
noFill()
stroke(255)
strokeWeight(4) //10
point(0 + y, 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() {
clearTimeout(inhale, time);
speed = 1
setTimeout(pause, time);
console.log(speed)
}
function pause() {
clearTimeout(pause, time2)
speed = 0
setTimeout(exhale, time2);
console.log(speed)
}
function exhale() {
clearTimeout(exhale, time)
speed = -1
// speed = -speed
setTimeout(pause2, time);
console.log(speed)
}
function pause2() {
clearTimeout(pause2, time3)
speed = 0
setTimeout(inhale, time3);
console.log(speed)
}