@visactor/vchart
Version:
charts lib based @visactor/VGrammar
48 lines (41 loc) • 1.45 kB
JavaScript
import { Factory } from "../../core/factory";
import { FadeInOutAnimation } from "../../animation/config";
export const sankeyGrowIn = (params, isOverall = !0) => ({
type: "horizontal" === params.direction ? "growWidthIn" : "growHeightIn",
options: {
overall: isOverall ? params.growFrom() : isOverall,
orient: "positive"
}
});
export const sankeyGrowOut = (params, isOverall = !0) => ({
type: "horizontal" === params.direction ? "growWidthOut" : "growHeightOut",
options: {
overall: isOverall ? params.growFrom() : isOverall,
orient: "positive"
}
});
export const sankeyNodePresetAnimation = (params, preset) => "fadeIn" === preset ? {
type: "fadeIn"
} : sankeyGrowIn(params);
export const sankeyLinkPresetAnimation = preset => "fadeIn" === preset ? {
type: "fadeIn"
} : {
type: "linkPathGrowIn"
};
export const registerSankeyAnimation = () => {
Factory.registerAnimation("sankeyNode", ((params, preset) => Object.assign({
appear: sankeyNodePresetAnimation(params, preset)
}, FadeInOutAnimation))), Factory.registerAnimation("sankeyLinkPath", ((params, preset) => ({
appear: sankeyLinkPresetAnimation(preset),
enter: {
type: "linkPathGrowIn"
},
exit: {
type: "linkPathGrowOut"
},
disappear: {
type: "linkPathGrowOut"
}
})));
};
//# sourceMappingURL=animation.js.map