Skip to content

Instantly share code, notes, and snippets.

@williwambu
Created September 3, 2018 07:13
Show Gist options
  • Save williwambu/e952524653cf08c873330306de4a28e4 to your computer and use it in GitHub Desktop.
Save williwambu/e952524653cf08c873330306de4a28e4 to your computer and use it in GitHub Desktop.
// Get two close points
const point1 = path.getPointAtLength(distance);
const point2 = path.getPointAtLength(distance + 1);
// Get angle(radians)
// Convert to degrees
const angle = Math.atan2(point1.y - point2.y, point1.x - point2.x) * (180 / Math.PI);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment