Bounce back to center if mouse leave

This commit is contained in:
BOTAlex 2024-03-31 07:26:15 +02:00
parent b444948903
commit c3a0c735fa
1 changed files with 6 additions and 0 deletions

View File

@ -51,9 +51,15 @@
windowRef.addEventListener("resize", updateDimensions); windowRef.addEventListener("resize", updateDimensions);
const RevertToOrigin = () => {
updateAnimation(new Vector2(windowWidth/2, windowHeight/2));
};
document.documentElement.addEventListener('mouseleave', RevertToOrigin)
return () => { return () => {
windowRef.removeEventListener("resize", updateDimensions); windowRef.removeEventListener("resize", updateDimensions);
}; };
}); });
const programmingLanguages: string[] = [ const programmingLanguages: string[] = [