Skip to content

Commit

Permalink
feat(animate): easing support function
Browse files Browse the repository at this point in the history
  • Loading branch information
simaQ committed Apr 23, 2018
1 parent 38d5535 commit 8fb20b8
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/graphic/animate/animator.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,13 @@ class Animator {
const delay = cfg.delay || 0;
const attrs = cfg.attrs || {};
const duration = cfg.duration || 1000;
const easing = Easing[cfg.easing] || Easing.linear;

let easing; // 缓动函数
if (typeof (cfg.easing) === 'function') {
easing = cfg.easing;
} else {
easing = Easing[cfg.easing] || Easing.linear;
}

const animInfo = {
shape: this.shape,
Expand Down Expand Up @@ -85,6 +91,16 @@ class Animator {
return this;
}

onFrame(callback) { // 自定义每一帧动画的动作
if (this.animate) {
this.animate.onFrame = function(frame) {
callback(frame);
};
}

return this;
}

onStart(callback) {
if (this.animate) {
this.animate.onStart = function() {
Expand Down

0 comments on commit 8fb20b8

Please sign in to comment.