Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function rotatePoint(point, pivot, angle) {
- let dx = point.x - pivot.x;
- let dy = point.y - pivot.y;
- let radians = angle * DEG2RAD;
- let sin = Math.sin(radians);
- let cos = Math.cos(radians);
- let x = Math.round(pivot.x + cos * dx - sin * dy);
- let y = Math.round(pivot.y + sin * dx + cos * dy);
- return new Point(x, y);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement