From 899dc410dc11533b118af4bd36c1b77fdd3d3198 Mon Sep 17 00:00:00 2001 From: Mottributo <87079566+Mottributo@users.noreply.github.com> Date: Thu, 23 Mar 2023 16:35:28 +0300 Subject: [PATCH] Added parallax to mountains --- sketch.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sketch.js b/sketch.js index 0022e40..1562ccd 100644 --- a/sketch.js +++ b/sketch.js @@ -608,8 +608,10 @@ function drawClouds() { } function drawMountains() { for (i = 0; i < mountains.length; i++) { + push(); + // slowing down translation to add parallax, the feeling of depth + translate(cameraPosX/8, 0); noStroke(); - fill(palette.mountain_shadow); triangle( mountains[i].x - mountains[i].width, @@ -628,6 +630,7 @@ function drawMountains() { mountains[i].x - mountains[i].width / 1.5, floorPos_y ); + pop(); } } function drawHeart(isEmpty, x, y, size) {