Skip to content

Instantly share code, notes, and snippets.

@conradoqg
Created April 1, 2017 14:32
Show Gist options
  • Select an option

  • Save conradoqg/02cd618782ffc94cfd00fad0ae5e2577 to your computer and use it in GitHub Desktop.

Select an option

Save conradoqg/02cd618782ffc94cfd00fad0ae5e2577 to your computer and use it in GitHub Desktop.
Rotate object
var newX = Math.cos(angle) * (this.x - origin.x) - Math.sin(angle) * (this.y - origin.y) + origin.x;
var newY = Math.sin(angle) * (this.x - origin.x) + Math.cos(angle) * (this.y - origin.y) + origin.y;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment