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