mirror of
https://github.com/KevinMidboe/cubewaves.git
synced 2025-12-29 13:11:07 +00:00
Changed the size of the canvas to be responsive to screen width to some extent and added a translate for wide screens so the canvas is pulled closer up.
This commit is contained in:
@@ -2,20 +2,29 @@ let angle = 0;
|
|||||||
let w = 40;
|
let w = 40;
|
||||||
let ma;
|
let ma;
|
||||||
let maxD;
|
let maxD;
|
||||||
|
let window_w;
|
||||||
|
|
||||||
function setup() {
|
function setup() {
|
||||||
createCanvas(600, 600, WEBGL);
|
window_w = min(window.innerWidth, 1200);
|
||||||
ma = atan(1 / sqrt(2))
|
createCanvas(window_w, window_w, WEBGL);
|
||||||
|
ma = atan(1 / sqrt(2));
|
||||||
maxD = dist(0, 0, 200, 200);
|
maxD = dist(0, 0, 200, 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
function draw() {
|
function draw() {
|
||||||
background("#1e1e1e");
|
background("#1e1e1e");
|
||||||
ortho(-700, 700, 700, -700, 0, 1200);
|
|
||||||
|
let o_w = window_w + 100;
|
||||||
|
ortho(-o_w, o_w, o_w, -o_w, 0, o_w + 500);
|
||||||
|
|
||||||
|
if (o_w > 750) {
|
||||||
|
translate(0, o_w * 0.35);
|
||||||
|
}
|
||||||
|
|
||||||
rotateX(-ma);
|
rotateX(-ma);
|
||||||
rotateY(QUARTER_PI);
|
rotateY(QUARTER_PI);
|
||||||
|
|
||||||
|
|
||||||
rectMode(CENTER);
|
rectMode(CENTER);
|
||||||
|
|
||||||
let offset = 0;
|
let offset = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user