Skip to content

Commit

Permalink
Merge pull request #457 from VisActor/fix/check-ACustomAnimate
Browse files Browse the repository at this point in the history
Fix/check a custom animate
  • Loading branch information
xile611 authored May 13, 2024
2 parents 865f2ef + 7e7db9d commit 14db5c2
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@visactor/vgrammar-core",
"comment": "fix: adapt custom animation to different vrender version",
"type": "none"
}
],
"packageName": "@visactor/vgrammar-core"
}
12 changes: 11 additions & 1 deletion packages/vgrammar-core/src/graph/animation/animator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,17 @@ Animate.mode |= AnimateMode.SET_ATTR_IMMEDIATELY;
let GlobalAnimatorId = 0;

const isCustomAnimateCtor = (custom?: IAnimationChannelInterpolator | IAnimationCustomConstructor) => {
return !isNil(custom) && custom.prototype instanceof ACustomAnimate;
if (isNil(custom)) {
return false;
}
return (
custom.prototype instanceof ACustomAnimate ||
// similar to ACustomAnimate, apply for different vrender version
('onBind' in custom.prototype &&
'onStart' in custom.prototype &&
'onEnd' in custom.prototype &&
'onUpdate' in custom.prototype)
);
};

export class Animator implements IAnimator {
Expand Down

0 comments on commit 14db5c2

Please sign in to comment.