tapspace
Version:
A zoomable user interface lib for web apps
20 lines (18 loc) • 509 B
JavaScript
const factor = Math.PI / 180
module.exports = function (degrees, origin) {
// @Basis:rotateByDegrees(degrees[, origin])
//
// Rotate the basis around the z-axis that intersects the origin point.
//
// Parameters:
// degrees
// a number, the amount to rotate in degrees.
// origin
// optional Point, the transform origin. Defaults to the basis origin.
//
// Return
// a Basis, the rotated basis
//
const rads = degrees * factor
return this.rotateBy(rads, origin)
}