Guest User

Untitled

a guest
Dec 10th, 2018
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. // Position of our element; object provided.
  2. const canvasPos = this.canvasEl.getBoundingClientRect()
  3.  
  4. // Position of the mouse-event relative to 'canvasPos'
  5. const evtPos = {
  6. x: clientX - canvasPos.left,
  7. y: clientY - canvasPos.top
  8. }
  9.  
  10. // e is the effective distance from the center; some pythag involved probs.
  11. const e = (evtPos.x - (canvasX / 2)) * (evtPos.x - (canvasX / 2)) + (evtPos.y - (canvasY / 2)) * (evtPos.y - (canvasY / 2))
Add Comment
Please, Sign In to add comment