UNPKG

actuate

Version:

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

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