Skip to content

Instantly share code, notes, and snippets.

@stephen-james
Created April 5, 2013 09:43
Show Gist options
  • Save stephen-james/5318026 to your computer and use it in GitHub Desktop.
Save stephen-james/5318026 to your computer and use it in GitHub Desktop.
Distance from Origin, distance between two pixels
// using pythags awesomeness
var distanceFromOrigin = Math.sqrt(Math.pow(origin.x - e.clientX, 2) + Math.pow(origin.y - e.clientY, 2));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment