tweenkle
Version:
Lightweight tweening library for all your tweening and animation needs.
36 lines (27 loc) • 981 B
JavaScript
;
exports.__esModule = true;
exports["default"] = exports.InOut = exports.Out = exports.In = void 0;
var In = function In(time, beginningValue, changeValue, duration) {
var s = 1.70158;
return changeValue * (time /= duration) * time * ((s + 1) * time - s) + beginningValue;
};
exports.In = In;
var Out = function Out(time, beginningValue, changeValue, duration) {
var s = 1.70158;
return changeValue * ((time = time / duration - 1) * time * ((s + 1) * time + s) + 1) + beginningValue;
};
exports.Out = Out;
var InOut = function InOut(time, beginningValue, changeValue, duration) {
var s = 1.70158;
if ((time /= duration / 2) < 1) {
return changeValue / 2 * (time * time * (((s *= 1.525) + 1) * time - s)) + beginningValue;
}
return changeValue / 2 * ((time -= 2) * time * (((s *= 1.525) + 1) * time + s) + 2) + beginningValue;
};
exports.InOut = InOut;
var _default = {
In: In,
Out: Out,
InOut: InOut
};
exports["default"] = _default;