UNPKG

@visactor/vchart

Version:

charts lib based @visactor/VGrammar

181 lines (156 loc) 7.7 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: !0 }), exports.registerStageAnimation = exports.registerPolygonAnimation = exports.registerLineOrAreaAnimation = exports.registerArcAnimation = exports.registerRectAnimation = exports.registerBuiltInAnimation = exports.registerAreaAnimation = exports.registerLineAnimation = exports.registerCartesianGroupClipAnimation = exports.registerFadeInOutAnimation = exports.registerScaleInOutAnimation = exports.FadeInOutAnimation = exports.ScaleInOutAnimation = exports.DEFAULT_ANIMATION_CONFIG = void 0; const vrender_animate_1 = require("@visactor/vrender-animate"), animation_1 = require("../series/line/animation"), factory_1 = require("../core/factory"), callback_disappear_1 = require("./callback-disappear"), animate_1 = require("../constant/animate"); 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" } }, exports.FadeInOutAnimation = { appear: { type: "fadeIn" }, enter: { type: "fadeIn" }, exit: { 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_animate_1.ClipDirectionAnimate, customParameters: (datum, g) => ({ animationType: "in", group: g, 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_animate_1.TagPointsUpdate, duration: exports.DEFAULT_ANIMATION_CONFIG.update.duration, easing: exports.DEFAULT_ANIMATION_CONFIG.update.easing, customParameters: { clipRangeByDimension: "horizontal" === params.direction ? "y" : "x" } } ] }), registerLineAnimation = () => { factory_1.Factory.registerAnimation("line", lineOrAreaAnimation); }; exports.registerLineAnimation = registerLineAnimation; const registerAreaAnimation = () => { factory_1.Factory.registerAnimation("area", lineOrAreaAnimation); }; exports.registerAreaAnimation = registerAreaAnimation; const registerBuiltInAnimation = () => { vrender_animate_1.AnimateExecutor.registerBuiltInAnimate("scaleIn", vrender_animate_1.ScaleIn), vrender_animate_1.AnimateExecutor.registerBuiltInAnimate("scaleOut", vrender_animate_1.ScaleOut), vrender_animate_1.AnimateExecutor.registerBuiltInAnimate("fadeIn", vrender_animate_1.FadeIn), vrender_animate_1.AnimateExecutor.registerBuiltInAnimate("fadeOut", vrender_animate_1.FadeOut), vrender_animate_1.AnimateExecutor.registerBuiltInAnimate("moveIn", vrender_animate_1.MoveIn), vrender_animate_1.AnimateExecutor.registerBuiltInAnimate("moveOut", vrender_animate_1.MoveOut), vrender_animate_1.AnimateExecutor.registerBuiltInAnimate("rotateIn", vrender_animate_1.RotateIn), vrender_animate_1.AnimateExecutor.registerBuiltInAnimate("rotateOut", vrender_animate_1.RotateOut), vrender_animate_1.AnimateExecutor.registerBuiltInAnimate("update", vrender_animate_1.Update), vrender_animate_1.AnimateExecutor.registerBuiltInAnimate("state", vrender_animate_1.State), vrender_animate_1.AnimateExecutor.registerBuiltInAnimate("fromTo", vrender_animate_1.FromTo); }; exports.registerBuiltInAnimation = registerBuiltInAnimation; const registerRectAnimation = () => { vrender_animate_1.AnimateExecutor.registerBuiltInAnimate("growHeightIn", vrender_animate_1.GrowHeightIn), vrender_animate_1.AnimateExecutor.registerBuiltInAnimate("growHeightOut", vrender_animate_1.GrowHeightOut), vrender_animate_1.AnimateExecutor.registerBuiltInAnimate("growWidthIn", vrender_animate_1.GrowWidthIn), vrender_animate_1.AnimateExecutor.registerBuiltInAnimate("growWidthOut", vrender_animate_1.GrowWidthOut), vrender_animate_1.AnimateExecutor.registerBuiltInAnimate("growCenterIn", vrender_animate_1.GrowCenterIn), vrender_animate_1.AnimateExecutor.registerBuiltInAnimate("growCenterOut", vrender_animate_1.GrowCenterOut); }; exports.registerRectAnimation = registerRectAnimation; const registerArcAnimation = () => { vrender_animate_1.AnimateExecutor.registerBuiltInAnimate("growRadiusIn", vrender_animate_1.GrowRadiusIn), vrender_animate_1.AnimateExecutor.registerBuiltInAnimate("growRadiusOut", vrender_animate_1.GrowRadiusOut), vrender_animate_1.AnimateExecutor.registerBuiltInAnimate("growAngleIn", vrender_animate_1.GrowAngleIn), vrender_animate_1.AnimateExecutor.registerBuiltInAnimate("growAngleOut", vrender_animate_1.GrowAngleOut); }; exports.registerArcAnimation = registerArcAnimation; const registerLineOrAreaAnimation = () => { vrender_animate_1.AnimateExecutor.registerBuiltInAnimate("growPointsIn", vrender_animate_1.GrowPointsIn), vrender_animate_1.AnimateExecutor.registerBuiltInAnimate("growPointsOut", vrender_animate_1.GrowPointsOut), vrender_animate_1.AnimateExecutor.registerBuiltInAnimate("growPointsXIn", vrender_animate_1.GrowPointsXIn), vrender_animate_1.AnimateExecutor.registerBuiltInAnimate("growPointsXOut", vrender_animate_1.GrowPointsXOut), vrender_animate_1.AnimateExecutor.registerBuiltInAnimate("growPointsYIn", vrender_animate_1.GrowPointsYIn), vrender_animate_1.AnimateExecutor.registerBuiltInAnimate("growPointsYOut", vrender_animate_1.GrowPointsYOut), vrender_animate_1.AnimateExecutor.registerBuiltInAnimate("clipIn", vrender_animate_1.ClipIn), vrender_animate_1.AnimateExecutor.registerBuiltInAnimate("clipOut", vrender_animate_1.ClipOut); }; exports.registerLineOrAreaAnimation = registerLineOrAreaAnimation; const registerPolygonAnimation = () => { vrender_animate_1.AnimateExecutor.registerBuiltInAnimate("growPointsOut", vrender_animate_1.GrowPointsOut); }; exports.registerPolygonAnimation = registerPolygonAnimation; const registerStageAnimation = () => { vrender_animate_1.AnimateExecutor.registerBuiltInAnimate(animate_1.BuiltIn_DISAPPEAR_ANIMATE_NAME, callback_disappear_1.CallbackDisappearAnimate); }; exports.registerStageAnimation = registerStageAnimation; //# sourceMappingURL=config.js.map