Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Position of our element; object provided.
- const canvasPos = this.canvasEl.getBoundingClientRect()
- // Position of the mouse-event relative to 'canvasPos'
- const evtPos = {
- x: clientX - canvasPos.left,
- y: clientY - canvasPos.top
- }
- // e is the effective distance from the center; some pythag involved probs.
- 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