Skip to content

Commit

Permalink
updateforcommit
Browse files Browse the repository at this point in the history
  • Loading branch information
mzelder committed Jul 29, 2024
1 parent b7d5d67 commit 814c960
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 20 deletions.
Binary file modified .DS_Store
Binary file not shown.
23 changes: 3 additions & 20 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ document.addEventListener("DOMContentLoaded", () => {
const fanHalfHeight = fanHeight / 2;

// Create obstacles columns
createColumns(4);
createColumns(3);
const lamp = document.querySelectorAll(".lamp");
const plant = document.querySelectorAll(".plant");
const lampHitBox = document.querySelectorAll(".lamp-hitbox");
Expand Down Expand Up @@ -75,7 +75,7 @@ document.addEventListener("DOMContentLoaded", () => {
let distance = Math.sqrt(dx * dx + dy * dy);

// Define a force multiplier (adjust as needed)
let forceMultiplier = 2;
let forceMultiplier = 5;

// Calculate the potential new position of trash
let newLeft = trash.offsetLeft - (dx / distance * forceMultiplier);
Expand All @@ -88,7 +88,7 @@ document.addEventListener("DOMContentLoaded", () => {
if (newTop >= margin && newTop + trash.offsetHeight <= bodyHeight - margin) {
trash.style.top = newTop + "px";
}
}, 5);
}, 10);

// Function to calculate fan angle and update its position
function updateFanPositionAndAngle() {
Expand Down Expand Up @@ -193,21 +193,4 @@ document.addEventListener("DOMContentLoaded", () => {
});
});
}

function getViewPort() {
return {
width: window.innerWidth,
height: window.innerHeight
};
}

function resizeElements() {
const { width, height } = getViewPort();

trash.style.width = `${width * trashSize}px`;

fan.style.width = `${width * fanSize}vh`;
fan.style.height = `${height * fanSize}vh`;

}
});

0 comments on commit 814c960

Please sign in to comment.