moved moving fraction into constant

This commit is contained in:
Václav Šmejkal 2023-05-17 07:39:47 +02:00
parent 5949e057f0
commit 4612c3232d
Signed by: ENGO150
GPG Key ID: F6D6DF86242C5A59

View File

@ -1,5 +1,7 @@
//CONSTANTS
const WIDTH = 1000; const WIDTH = 1000;
const ASPECT_RATIO = 1/2; const ASPECT_RATIO = 1/2;
const MOVE_PIECES = 1/8;
//CANVAS SHIT //CANVAS SHIT
let ctx; let ctx;
@ -31,8 +33,8 @@ function load_panorama()
function turn_left() //TODO: MOVE THE RIGHT PART TO LEFT function turn_left() //TODO: MOVE THE RIGHT PART TO LEFT
{ {
//MOVE AN 8th TO LEFT //MOVE AN 8th TO LEFT
x1 -= WIDTH / 8; x1 -= WIDTH * MOVE_PIECES;
x2 -= WIDTH / 8; 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
} }