Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x | /* eslint-disable no-plusplus */ /** * 简单的 Easing Functions * - 值域变化范围,从 [0, 1] 到 [0, 1] * - 即输入值范围从 0 到 1 * - 输出也为从 0 到 1 * - 适合进行百分比动画运算 * * 动画函数 * - linear * - easeInQuad * - easeOutQuad * - easeInOutQuad * - easeInCubic * - easeInQuart * - easeOutQuart * - easeInOutQuart * - easeInQuint * - easeOutQuint * - easeInOutQuint * @module fx/easing * @see [easing.js](https://gist.github.com/gre/1650294) * @example * var $easing = require('@spore-ui/kit/packages/fx/easing'); * $easing.linear(0.5); // 0.5 * $easing.easeInQuad(0.5); // 0.25 * $easing.easeInCubic(0.5); // 0.125 */ var easing = { // no easing, no acceleration linear: function (t) { return t; }, // accelerating from zero velocity easeInQuad: function (t) { return t * t; }, // decelerating to zero velocity easeOutQuad: function (t) { return t * (2 - t); }, // acceleration until halfway, then deceleration easeInOutQuad: function (t) { return t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t; }, // accelerating from zero velocity easeInCubic: function (t) { return t * t * t; }, // decelerating to zero velocity easeOutCubic: function (t) { return (--t) * t * t + 1; }, // acceleration until halfway, then deceleration easeInOutCubic: function (t) { return t < 0.5 ? 4 * t * t * t : (t - 1) * (2 * t - 2) * (2 * t - 2) + 1; }, // accelerating from zero velocity easeInQuart: function (t) { return t * t * t * t; }, // decelerating to zero velocity easeOutQuart: function (t) { return 1 - (--t) * t * t * t; }, // acceleration until halfway, then deceleration easeInOutQuart: function (t) { return t < 0.5 ? 8 * t * t * t * t : 1 - 8 * (--t) * t * t * t; }, // accelerating from zero velocity easeInQuint: function (t) { return t * t * t * t * t; }, // decelerating to zero velocity easeOutQuint: function (t) { return 1 + (--t) * t * t * t * t; }, // acceleration until halfway, then deceleration easeInOutQuint: function (t) { return t < 0.5 ? 16 * t * t * t * t * t : 1 + 16 * (--t) * t * t * t * t; }, }; module.exports = easing; |