UNPKG

@visactor/vchart

Version:

charts lib based @visactor/VGrammar

170 lines (147 loc) 6.42 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: !0 }), exports.registerVGrammarPolygonAnimation = exports.registerVGrammarLineOrAreaAnimation = exports.registerVGrammarArcAnimation = exports.registerVGrammarRectAnimation = exports.registerVGrammarCommonAnimation = exports.registerAreaAnimation = exports.registerLineAnimation = exports.registerCartesianGroupClipAnimation = exports.registerFadeInOutAnimation = exports.registerScaleInOutAnimation = exports.FadeInOutAnimation = exports.ScaleInOutAnimation = exports.DEFAULT_ANIMATION_CONFIG = void 0; const vrender_core_1 = require("@visactor/vrender-core"), animation_1 = require("../series/line/animation"), factory_1 = require("../core/factory"), vgrammar_core_1 = require("@visactor/vgrammar-core"); exports.DEFAULT_ANIMATION_CONFIG = { appear: { duration: 1e3, easing: "cubicOut" }, update: { type: "update", duration: 300, easing: "linear" }, enter: { duration: 300, easing: "linear" }, exit: { duration: 300, easing: "linear" }, disappear: { duration: 500, easing: "cubicIn" }, state: { duration: 300, easing: "linear" } }, exports.ScaleInOutAnimation = { appear: { type: "scaleIn" }, enter: { type: "scaleIn" }, exit: { type: "scaleOut" }, disappear: { type: "scaleOut" } }, exports.FadeInOutAnimation = { appear: { type: "fadeIn" }, enter: { type: "fadeIn" }, exit: { type: "fadeOut" }, disappear: { type: "fadeOut" } }; const registerScaleInOutAnimation = () => { factory_1.Factory.registerAnimation("scaleInOut", (() => exports.ScaleInOutAnimation)); }; exports.registerScaleInOutAnimation = registerScaleInOutAnimation; const registerFadeInOutAnimation = () => { factory_1.Factory.registerAnimation("fadeInOut", (() => exports.FadeInOutAnimation)); }; exports.registerFadeInOutAnimation = registerFadeInOutAnimation; const registerCartesianGroupClipAnimation = () => { factory_1.Factory.registerAnimation("cartesianGroupClip", (params => ({ appear: { custom: vrender_core_1.ClipDirectionAnimate, customParameters: (datum, element) => ({ animationType: "in", group: element.getGraphicItem(), direction: params.direction(), width: params.width(), height: params.height(), orient: params.orient() }) }, disappear: { custom: vrender_core_1.ClipDirectionAnimate, customParameters: (datum, element) => ({ animationType: "out", group: element.getGraphicItem(), direction: params.direction(), width: params.width(), height: params.height(), orient: params.orient() }) } }))); }; exports.registerCartesianGroupClipAnimation = registerCartesianGroupClipAnimation; const lineOrAreaAnimation = (params, preset) => ({ appear: (0, animation_1.linePresetAnimation)(params, preset), enter: { type: "fadeIn" }, exit: { type: "fadeOut" }, update: [ { type: "update", options: { excludeChannels: [ "points", "defined", "segments" ] } }, { channel: [ "points", "segments" ], custom: vrender_core_1.TagPointsUpdate, duration: exports.DEFAULT_ANIMATION_CONFIG.update.duration, easing: exports.DEFAULT_ANIMATION_CONFIG.update.easing, customParameters: { clipRangeByDimension: "horizontal" === params.direction ? "y" : "x" } } ], disappear: { type: "clipOut" } }), registerLineAnimation = () => { factory_1.Factory.registerAnimation("line", lineOrAreaAnimation); }; exports.registerLineAnimation = registerLineAnimation; const registerAreaAnimation = () => { factory_1.Factory.registerAnimation("area", lineOrAreaAnimation); }; exports.registerAreaAnimation = registerAreaAnimation; const registerVGrammarCommonAnimation = () => { vgrammar_core_1.View.useRegisters([ vgrammar_core_1.registerScaleInAnimation, vgrammar_core_1.registerScaleOutAnimation, vgrammar_core_1.registerFadeInAnimation, vgrammar_core_1.registerFadeOutAnimation, vgrammar_core_1.registerMoveInAnimation, vgrammar_core_1.registerMoveOutAnimation, vgrammar_core_1.registerRotateInAnimation, vgrammar_core_1.registerRotateOutAnimation, vgrammar_core_1.registerUpdateAnimation ]); }; exports.registerVGrammarCommonAnimation = registerVGrammarCommonAnimation; const registerVGrammarRectAnimation = () => { vgrammar_core_1.View.useRegisters([ vgrammar_core_1.registerGrowHeightInAnimation, vgrammar_core_1.registerGrowHeightOutAnimation, vgrammar_core_1.registerGrowWidthInAnimation, vgrammar_core_1.registerGrowWidthOutAnimation, vgrammar_core_1.registerGrowCenterInAnimation, vgrammar_core_1.registerGrowCenterOutAnimation ]); }; exports.registerVGrammarRectAnimation = registerVGrammarRectAnimation; const registerVGrammarArcAnimation = () => { vgrammar_core_1.View.useRegisters([ vgrammar_core_1.registerGrowRadiusInAnimation, vgrammar_core_1.registerGrowRadiusOutAnimation, vgrammar_core_1.registerGrowAngleInAnimation, vgrammar_core_1.registerGrowAngleOutAnimation ]); }; exports.registerVGrammarArcAnimation = registerVGrammarArcAnimation; const registerVGrammarLineOrAreaAnimation = () => { vgrammar_core_1.View.useRegisters([ vgrammar_core_1.registerGrowPointsInAnimation, vgrammar_core_1.registerGrowPointsOutAnimation, vgrammar_core_1.registerGrowPointsXInAnimation, vgrammar_core_1.registerGrowPointsXOutAnimation, vgrammar_core_1.registerGrowPointsYInAnimation, vgrammar_core_1.registerGrowPointsYOutAnimation, vgrammar_core_1.registerClipInAnimation, vgrammar_core_1.registerClipOutAnimation ]); }; exports.registerVGrammarLineOrAreaAnimation = registerVGrammarLineOrAreaAnimation; const registerVGrammarPolygonAnimation = () => { vgrammar_core_1.View.useRegisters([ vgrammar_core_1.registerGrowPointsInAnimation, vgrammar_core_1.registerGrowPointsOutAnimation ]); }; exports.registerVGrammarPolygonAnimation = registerVGrammarPolygonAnimation; //# sourceMappingURL=config.js.map