xxxxxxxxxx
136
let x = 20;
let speed;
let y = 0
//let ac = 0.0001;
let me = x;
let c=x
let easing = 0.05;
let starX;
let starY;
let starSize;
let time = 7000;
function setup() {
createCanvas(400, 400);
background(0);
pixelDensity(1)
inhale()
frameRate(30)
}
function draw() {
stroke((255-x), (255-x), (255-x), x)
strokeWeight(10)
noFill()
circle(width / 2, height / 2, x)
x = x + speed
y = y + 0.1
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(10)
// me= map(me, 0, x, height,0)
point(0 + y, me);
filter(BLUR, 3)
// darker wave point
stroke(255)
strokeWeight(3)
point(0 + y, me);
// 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
//ac++
setTimeout(pause, time);
console.log(speed)
}
function pause() {
clearTimeout(pause, time)
speed = 0
// ac = 0
setTimeout(exhale, time);
console.log(speed)
}
function exhale() {
clearTimeout(exhale, time)
speed = 1
speed = -speed
// ac = -(ac++)
setTimeout(pause2, time);
console.log(speed)
}
function pause2() {
clearTimeout(pause2, time)
speed = 0
// ac = 0
setTimeout(inhale, time);
console.log(speed)
}