Please enable / Bitte aktiviere JavaScript!
Veuillez activer / Por favor activa el Javascript![ ? ]
If the animation associated with the cursor takes the offset of the element from the cursor position? - bug-code.com Q&A

If the animation associated with the cursor takes the offset of the element from the cursor position?

0 like 0 dislike
11 views
Why in this example (https://an2-studio.xyz/dvizhenie-obekta-v-storonu-...) perform the subtraction position of the element from the cursor position?

mouseX = Math.min(e.pageX - offset.left, limitX);

And another question - on all the animations of the blocks depending on the cursor position, when you set css pageX or pageY divided into a different number, for example, add a number, such as e.pageX / 50 + 200 - it is selected manually or has any principles?
asked by | 11 views

1 Answer

0 like 0 dislike
1. Subtract to move the Anchor point to the center of the object.

2.
And another question - on all the animations of the blocks depending on the cursor position, when you set css pageX or pageY divided into a different number, for example, add a number, such as e.pageX / 50 + 200 - it is selected manually or has any principles?
saw this in the code...
answered by
Welcome to Bug-code Q&A, where you can ask questions and receive answers from other members of the community.

24.8k questions

46.2k answers

0 comments

13.3k users

24,788 questions
46,220 answers
0 comments
13,322 users