actuate
Version:
Actuate is a flexible, fast "tween" library for animations
61 lines (43 loc) • 1.49 kB
JavaScript
// Class: motion._MotionPath.RotationPath
var $global = typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this
$global.Object.defineProperty(exports, "__esModule", {value: true});
var __map_reserved = {};
// Imports
var $hxClasses = require("./../../hxClasses_stub").default;
var $import = require("./../../import_stub").default;
function motion_IComponentPath() {return require("./../../motion/IComponentPath");}
// Constructor
var RotationPath = function(x,y) {
this.step = 0.01;
this._x = x;
this._y = y;
this.offset = 0;
this.set_start(this.calculate(0.0));
}
// Meta
RotationPath.__name__ = ["motion","_MotionPath","RotationPath"];
RotationPath.__isInterface__ = false;
RotationPath.__interfaces__ = [(motion_IComponentPath().default)];
RotationPath.prototype = {
calculate: function(k) {
var dX = this._x.calculate(k) - this._x.calculate(k + this.step);
var dY = this._y.calculate(k) - this._y.calculate(k + this.step);
var angle = Math.atan2(dY,dX) * (180 / Math.PI);
angle = (angle + this.offset) % 360;
return angle;
},
get_start: function() {
return this._start;
},
set_start: function(value) {
return this._start;
},
get_end: function() {
return this.calculate(1.0);
}
};
RotationPath.prototype.__class__ = RotationPath.prototype.constructor = $hxClasses["motion._MotionPath.RotationPath"] = RotationPath;
// Init
// Statics
// Export
exports.default = RotationPath;