We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b273ebe commit 72475ffCopy full SHA for 72475ff
16 - Mouse Move Shadow/my-index.html
@@ -36,11 +36,9 @@ <h1 contenteditable>🔥WOAH!</h1>
36
const text = hero.querySelector('h1');
37
38
function update(event) {
39
- const maxX = window.screen.availWidth;
40
- const maxY = window.screen.availHeight;
41
- const mouseX = event.screenX;
+ const {availWidth: maxX, availHeight: maxY} = window.screen;
+ const {screenX: mouseX, screenY: mouseY} = event;
42
const center = {x: maxX / 2, y: maxY / 2};
43
- const mouseY = event.screenY;
44
const constraint = 200
45
const shadowX = ((mouseX - center.x)/ maxX) * constraint;
46
const shadowY = ((mouseY - center.y) / maxY ) * constraint;
0 commit comments