Blame view

node_modules/zrender/lib/animation/cubicEasing.js 787 Bytes
bd028579   易尊强   2/28
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
  import { cubicAt, cubicRootAt } from '../core/curve.js';
  import { trim } from '../core/util.js';
  var regexp = /cubic-bezier\(([0-9,\.e ]+)\)/;
  export function createCubicEasingFunc(cubicEasingStr) {
      var cubic = cubicEasingStr && regexp.exec(cubicEasingStr);
      if (cubic) {
          var points = cubic[1].split(',');
          var a_1 = +trim(points[0]);
          var b_1 = +trim(points[1]);
          var c_1 = +trim(points[2]);
          var d_1 = +trim(points[3]);
          if (isNaN(a_1 + b_1 + c_1 + d_1)) {
              return;
          }
          var roots_1 = [];
          return function (p) {
              return p <= 0
                  ? 0 : p >= 1
                  ? 1
                  : cubicRootAt(0, a_1, c_1, 1, p, roots_1) && cubicAt(0, b_1, d_1, 1, roots_1[0]);
          };
      }
  }