register.js 525 B

12345678910111213141516171819
  1. import * as d3Ease from 'd3-ease';
  2. var EASING_MAP = {};
  3. /**
  4. * 根据名称获取对应的动画缓动函数
  5. * @param type 动画缓动函数名称
  6. */
  7. export function getEasing(type) {
  8. // 默认从 d3-ease 中获取
  9. return EASING_MAP[type.toLowerCase()] || d3Ease[type];
  10. }
  11. /**
  12. * 注册动画缓动函数
  13. * @param type 动画缓动函数名称
  14. * @param easeFn 动画缓动函数
  15. */
  16. export function registerEasing(type, easeFn) {
  17. EASING_MAP[type.toLowerCase()] = easeFn;
  18. }
  19. //# sourceMappingURL=register.js.map