Skip to content

Commit 72475ff

Browse files
committed
Use object destructuring
1 parent b273ebe commit 72475ff

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

16 - Mouse Move Shadow/my-index.html

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,9 @@ <h1 contenteditable>🔥WOAH!</h1>
3636
const text = hero.querySelector('h1');
3737

3838
function update(event) {
39-
const maxX = window.screen.availWidth;
40-
const maxY = window.screen.availHeight;
41-
const mouseX = event.screenX;
39+
const {availWidth: maxX, availHeight: maxY} = window.screen;
40+
const {screenX: mouseX, screenY: mouseY} = event;
4241
const center = {x: maxX / 2, y: maxY / 2};
43-
const mouseY = event.screenY;
4442
const constraint = 200
4543
const shadowX = ((mouseX - center.x)/ maxX) * constraint;
4644
const shadowY = ((mouseY - center.y) / maxY ) * constraint;

0 commit comments

Comments
 (0)