UNPKG

tweenkle

Version:

Lightweight tweening library for all your tweening and animation needs.

32 lines (24 loc) 865 B
"use strict"; exports.__esModule = true; exports["default"] = exports.InOut = exports.Out = exports.In = void 0; var In = function In(time, beginningValue, changeValue, duration) { return changeValue * (time /= duration) * time * time * time + beginningValue; }; exports.In = In; var Out = function Out(time, beginningValue, changeValue, duration) { return -changeValue * ((time = time / duration - 1) * time * time * time - 1) + beginningValue; }; exports.Out = Out; var InOut = function InOut(time, beginningValue, changeValue, duration) { if ((time /= duration / 2) < 1) { return changeValue / 2 * time * time * time * time + beginningValue; } return -changeValue / 2 * ((time -= 2) * time * time * time - 2) + beginningValue; }; exports.InOut = InOut; var _default = { In: In, Out: Out, InOut: InOut }; exports["default"] = _default;