UNPKG

wilderness-core

Version:
52 lines (40 loc) 1.6 kB
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; /* globals __DEV__ */ var _tweenFunctions = require('tween-functions'); var _tweenFunctions2 = _interopRequireDefault(_tweenFunctions); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /** * An easing function. * * @param {(function|string)} easing - An easing function or the name of an easing function from https://github.com/chenglou/tween-functions. * * @returns {function} * * @example * easingFunc('easeInOutQuad') */ var easingFunction = function easingFunction(easing) { switch (typeof easing === 'undefined' ? 'undefined' : _typeof(easing)) { case 'string': if (_tweenFunctions2.default[easing]) { return _tweenFunctions2.default[easing]; } if (process.env.NODE_ENV !== 'production') { throw new TypeError('Easing must match one of the options defined by https://github.com/chenglou/tween-functions'); } /* istanbul ignore next */ break; case 'function': return easing; default: if (process.env.NODE_ENV !== 'production') { throw new TypeError('Easing must be of type function or string'); } /* istanbul ignore next */ break; } }; exports.default = easingFunction;