xxxxxxxxxx
133
let x = 20;
let speed = 0.1;
let y = 0
let ac = 0.01;
let me = x;
let easing = 0.05;
let starX;
let starY;
let starSize;
function setup() {
createCanvas(400, 400);
//background(220);
// pixelDensity(1)
frameRate(200)
// ellipseMode(RADIUS);
}
function draw() {
stroke(200+x, 200+x, 200+x, 50)
strokeWeight(10)
//fill(0 + x)
noFill()
circle(width / 2, height / 2, x)
if (x >= 20 && x < 100) {
//fill(0 + x)
speed = speed
// ac++
ac = ac
}
else if (x >= 100 && x < 150) {
speed = speed
// ac++
ac = ac
}
else if (x <= 150 && x > 20){
speed = -speed
// ac = -(ac++)
ac = -ac
}
else if (x <= 20 && x > 0){
speed = -speed
// ac = -(ac++)
ac = -ac
}
x = x + speed + ac
y = y + 0.03
// wave ease - in
let targetY = x; // breathing input // also circle
let dy = targetY - me;
me += dy * easing;
// max - min?
//me = map(me, 20, 50, 50,350) // max and min
// wave trail
noFill()
stroke(255)
strokeWeight(1)
point(0 + y, me);
// filter(BLUR, 3)
// darker wave point
stroke(255)
strokeWeight(1)
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);
}