Added clouds parallax

This commit is contained in:
Mottributo 2023-03-23 16:39:49 +03:00
parent 899dc410dc
commit a813bbb804

View File

@ -575,6 +575,9 @@ function drawClouds() {
for (i = 0; i < clouds.length; i++) { for (i = 0; i < clouds.length; i++) {
push(); push();
translate((frameCount / clouds[i].y) * 20, 0); // imitating clouds movement, upper ones should go faster translate((frameCount / clouds[i].y) * 20, 0); // imitating clouds movement, upper ones should go faster
// Adding counter-translating to implement parallax, the feeling of depth
// TODO: fix jitter during movement (possibly by implementing vectorized movement)
translate(cameraPosX/1.1, 0);
noStroke(); noStroke();
fill(palette.cloud0); fill(palette.cloud0);
ellipse( ellipse(