释放缓动

指定一个自定义缓动,在拖拽元素释放、发生吸附事件或拖出边界重新定位后应用于该元素。

接受

ease

传入 createSpring() 会覆盖可拖拽元素的 releaseMassreleaseStiffnessreleaseDamping 参数。createSpring()velocity 参数无效,并会被拖拽元素的实际速度取代。

默认值

eases.outQuint

releaseEase 代码示例

import { createDraggable, createSpring } from 'animejs';

createDraggable('.square', {
  container: '.grid',
  releaseEase: 'outElastic',
});

createDraggable('.circle', {
  container: '.grid',
  releaseEase: createSpring({
    stiffness: 150,
    damping: 15,
  })
});
<div class="large centered grid square-grid">
  <div class="square draggable"></div>
  <div class="circle draggable"></div>
</div>