fabric 缓动效果:匀速

匀速函数

// 匀速
const easeLinear = (t, b, c, d) => {
    return c*t/d + b;
}

使用

fabric.util.animate({
    startValue: 0.001,// 修改scaleX,不能是0
    endValue: 1,
    duration: 2000,
    onChange: (value) => { // 过程函数
      element.scaleX = value
      canvasFab.renderAll();
    },
    easing:easeLinear // 使用匀速
});