Skip to content
Snippets Groups Projects
Verified Commit 4a810f88 authored by TheJoeCoder's avatar TheJoeCoder
Browse files

Whitespace and comments

parent fc7a6b46
Branches
No related tags found
No related merge requests found
......@@ -251,16 +251,26 @@ window.addEventListener("mousemove", (event) => {
});
window.addEventListener("resize", () => {
// Width before resize
let oldWidth = canvas.width;
// Height before resize
let oldHeight = canvas.height;
// Set canvas size and display parameters
setDisplayParameters();
// Calculate old to new width ratio
let widthRatio = canvas.width / oldWidth;
// Calculate old to new height ratio
let heightRatio = canvas.height / oldHeight;
// Loop all dots
// Loop through all dots
for (let i = 0; i < dots.length; i++) {
let dot = dots[i];
// Reset radius of dots
dot.radius = randInt(RADIUS_MIN, RADIUS_MAX);
// Reset dots positions outside new window if the window has gotten smaller
dot.x = dot.x * widthRatio;
dot.y = dot.y * heightRatio;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment