From 00cae227904acce709f698021b858fb541a5378f Mon Sep 17 00:00:00 2001 From: "A. Bryant" Date: Tue, 18 Jul 2023 13:47:29 -0600 Subject: [PATCH] dots-optimization --- src/components/Dots.tsx | 15 ++++++++++----- src/css/dots.module.css | 2 +- src/css/terminal.module.css | 4 ++-- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/components/Dots.tsx b/src/components/Dots.tsx index 2b0380c..7f64356 100644 --- a/src/components/Dots.tsx +++ b/src/components/Dots.tsx @@ -8,17 +8,22 @@ const Dots = () => { useEffect(() => { const dotSize:number = 4; - const spacing:number = dotSize * 16; + const spacing:number = dotSize * 8; const minTvalue:number = 50; - const areaAffected:number = 80; + const areaAffected:number = 50; let mouseIsMoving:boolean = false; let dots:any[] = []; const sketch = (p: p5) => { + + p.disableFriendlyErrors = true; + p.setup = () => { - p.createCanvas(p.windowWidth, document.documentElement.scrollHeight); - for (let i = 0; i < p.width; i += spacing) { - for (let j = 0; j < p.height; j += spacing) { + p.createCanvas(p.windowWidth, p.windowHeight); + for (let i = 0; i < p.width; i += spacing) + { + for (let j = 0; j < p.height; j += spacing) + { let dot = new Dot(i + spacing / 2, j + spacing / 2, dotSize); dots.push(dot); } diff --git a/src/css/dots.module.css b/src/css/dots.module.css index 420f86c..876b4af 100644 --- a/src/css/dots.module.css +++ b/src/css/dots.module.css @@ -1,6 +1,6 @@ .background { - position: absolute; + position: fixed; z-index: -1; top: 0; } \ No newline at end of file diff --git a/src/css/terminal.module.css b/src/css/terminal.module.css index 5e8ca66..21a83d3 100644 --- a/src/css/terminal.module.css +++ b/src/css/terminal.module.css @@ -2,13 +2,13 @@ { height: 400px; width: 70%; - background-color: rgb(26, 26, 26); + background-color: rgb(39, 39, 39); color: white; box-sizing: border-box; font-size: 15px; overflow-y:auto; overflow-x: hidden; - border: 1px solid rgb(117, 117, 117); + border: 1px solid rgb(113, 113, 113); } .windowOptions