From 88b2f55566977de0aae329af0fc05074e217c5bc Mon Sep 17 00:00:00 2001 From: MrLento234 Date: Fri, 23 Sep 2022 13:57:53 +0200 Subject: [PATCH 1/3] full screen animation --- docs/art/brownian_motion/main.js | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/docs/art/brownian_motion/main.js b/docs/art/brownian_motion/main.js index 63580c6..6d884f9 100644 --- a/docs/art/brownian_motion/main.js +++ b/docs/art/brownian_motion/main.js @@ -3,34 +3,25 @@ // Date: 22.09.2022 // Global variables -const width = 600; -const height = 600; - -const xmid = width / 2; -const ymid = height / 2; - -const n_particles = 100; - let p = []; function setup() { - let canvas = createCanvas(width, height); + let canvas = createCanvas(windowWidth, windowHeight); canvas.parent("canvas"); - + let n_particles = int(windowHeight * windowHeight * 0.001); for (let i = 0; i < n_particles; i++) { - let x = random(width); - let y = random(height); - let dx = random(-5, 5); - let dy = random(-5, 5); + let x = random(windowWidth); + let y = random(windowHeight); + let dx = random(-10, 10); + let dy = random(-10, 10); let size = random(1, 5); p.push(new Point(x, y, dx, dy, size)); } - } function draw() { clear(); - for (let i=0; i < n_particles; i++) { + for (let i=0; i < p.length; i++) { p[i].move(); p[i].draw(); } From b4781eaa0e9a84536a98daa14e862099fd514196 Mon Sep 17 00:00:00 2001 From: MrLento234 Date: Fri, 23 Sep 2022 14:01:30 +0200 Subject: [PATCH 2/3] full screen --- docs/art/fibonacci_sphere/main.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/docs/art/fibonacci_sphere/main.js b/docs/art/fibonacci_sphere/main.js index fcac034..638ff27 100644 --- a/docs/art/fibonacci_sphere/main.js +++ b/docs/art/fibonacci_sphere/main.js @@ -3,11 +3,7 @@ // Based on Game of Life by Joan Soler-Adillon. // Global variables -const width = 600; -const height = width; - -const xmid = width / 2; -const ymid = height / 2; +let width, height, xmid, ymid, multiplier; const size = 3; const PI = Math.PI; @@ -15,10 +11,15 @@ const GA = (3 - Math.sqrt(5)) * PI; let N = 100; let factor = 1; -let multiplier = width / 2 - 10; function setup() { - let canvas = createCanvas(width, height); + width = Math.min(windowWidth, windowHeight); + height = width; + xmid = windowWidth/2; + ymid = windowHeight/2; + multiplier = width / 2 - 10; + + let canvas = createCanvas(windowWidth, windowHeight); canvas.parent("canvas"); } From b927251718769733b9473f7eca6e6279119c40f0 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 23 Sep 2022 12:01:51 +0000 Subject: [PATCH 3/3] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- docs/art/fibonacci_sphere/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/art/fibonacci_sphere/main.js b/docs/art/fibonacci_sphere/main.js index 638ff27..f8f031d 100644 --- a/docs/art/fibonacci_sphere/main.js +++ b/docs/art/fibonacci_sphere/main.js @@ -15,7 +15,7 @@ let factor = 1; function setup() { width = Math.min(windowWidth, windowHeight); height = width; - xmid = windowWidth/2; + xmid = windowWidth/2; ymid = windowHeight/2; multiplier = width / 2 - 10;