From 4612c3232d2001b0a5eee1799179fdf45a002cd8 Mon Sep 17 00:00:00 2001 From: ENGO150 Date: Wed, 17 May 2023 07:39:47 +0200 Subject: [PATCH] moved moving fraction into constant --- res/script.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/res/script.js b/res/script.js index 822a5cf..e6dc842 100644 --- a/res/script.js +++ b/res/script.js @@ -1,5 +1,7 @@ +//CONSTANTS const WIDTH = 1000; const ASPECT_RATIO = 1/2; +const MOVE_PIECES = 1/8; //CANVAS SHIT let ctx; @@ -31,8 +33,8 @@ function load_panorama() function turn_left() //TODO: MOVE THE RIGHT PART TO LEFT { //MOVE AN 8th TO LEFT - x1 -= WIDTH / 8; - x2 -= WIDTH / 8; + x1 -= WIDTH * MOVE_PIECES; + x2 -= WIDTH * MOVE_PIECES; - ctx.drawImage(img, x1, 0, img.width - WIDTH / 8, img.height, 0, 0, WIDTH, WIDTH * ASPECT_RATIO); //DRAW + ctx.drawImage(img, x1, 0, img.width - WIDTH * MOVE_PIECES, img.height, 0, 0, WIDTH, WIDTH * ASPECT_RATIO); //DRAW } \ No newline at end of file