UNPKG

actuate

Version:

Actuate is a flexible, fast "tween" library for animations

74 lines (56 loc) 1.7 kB
// Class: motion.easing._Elastic.ElasticEaseIn 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_easing_IEasing() {return require("./../../../motion/easing/IEasing");} // Constructor var ElasticEaseIn = function(a,p) { this.a = a; this.p = p; } // Meta ElasticEaseIn.__name__ = ["motion","easing","_Elastic","ElasticEaseIn"]; ElasticEaseIn.__isInterface__ = false; ElasticEaseIn.__interfaces__ = [(motion_easing_IEasing().default)]; ElasticEaseIn.prototype = { calculate: function(k) { if(k == 0) { return 0; } if(k == 1) { return 1; } var s; if(this.a < 1) { this.a = 1; s = this.p / 4; } else { s = this.p / (2 * Math.PI) * Math.asin(1 / this.a); } return -(this.a * Math.exp(6.931471805599453 * --k) * Math.sin((k - s) * (2 * Math.PI) / this.p)); }, ease: function(t,b,c,d) { if(t == 0) { return b; } if((t /= d) == 1) { return b + c; } var s; if(this.a < Math.abs(c)) { this.a = c; s = this.p / 4; } else { s = this.p / (2 * Math.PI) * Math.asin(c / this.a); } return -(this.a * Math.exp(6.931471805599453 * --t) * Math.sin((t * d - s) * (2 * Math.PI) / this.p)) + b; } }; ElasticEaseIn.prototype.__class__ = ElasticEaseIn.prototype.constructor = $hxClasses["motion.easing._Elastic.ElasticEaseIn"] = ElasticEaseIn; // Init // Statics // Export exports.default = ElasticEaseIn;