@visactor/vgrammar-core 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +160 -0
- package/README.zh-CN.md +11 -0
- package/cjs/component/axis.d.ts +26 -0
- package/cjs/component/axis.js +164 -0
- package/cjs/component/axis.js.map +1 -0
- package/cjs/component/crosshair.d.ts +50 -0
- package/cjs/component/crosshair.js +281 -0
- package/cjs/component/crosshair.js.map +1 -0
- package/cjs/component/datazoom.d.ts +19 -0
- package/cjs/component/datazoom.js +166 -0
- package/cjs/component/datazoom.js.map +1 -0
- package/cjs/component/grid.d.ts +27 -0
- package/cjs/component/grid.js +190 -0
- package/cjs/component/grid.js.map +1 -0
- package/cjs/component/index.d.ts +11 -0
- package/cjs/component/index.js +105 -0
- package/cjs/component/index.js.map +1 -0
- package/cjs/component/label.d.ts +19 -0
- package/cjs/component/label.js +121 -0
- package/cjs/component/label.js.map +1 -0
- package/cjs/component/legend.d.ts +26 -0
- package/cjs/component/legend.js +170 -0
- package/cjs/component/legend.js.map +1 -0
- package/cjs/component/player.d.ts +25 -0
- package/cjs/component/player.js +138 -0
- package/cjs/component/player.js.map +1 -0
- package/cjs/component/scale.d.ts +8 -0
- package/cjs/component/scale.js +25 -0
- package/cjs/component/scale.js.map +1 -0
- package/cjs/component/scrollbar.d.ts +23 -0
- package/cjs/component/scrollbar.js +187 -0
- package/cjs/component/scrollbar.js.map +1 -0
- package/cjs/component/slider.d.ts +19 -0
- package/cjs/component/slider.js +86 -0
- package/cjs/component/slider.js.map +1 -0
- package/cjs/component/title.d.ts +15 -0
- package/cjs/component/title.js +56 -0
- package/cjs/component/title.js.map +1 -0
- package/cjs/component/tooltip.d.ts +62 -0
- package/cjs/component/tooltip.js +305 -0
- package/cjs/component/tooltip.js.map +1 -0
- package/cjs/core/factory.d.ts +35 -0
- package/cjs/core/factory.js +73 -0
- package/cjs/core/factory.js.map +1 -0
- package/cjs/glyph/boxplot.d.ts +10 -0
- package/cjs/glyph/boxplot.js +418 -0
- package/cjs/glyph/boxplot.js.map +1 -0
- package/cjs/glyph/index.d.ts +7 -0
- package/cjs/glyph/index.js +64 -0
- package/cjs/glyph/index.js.map +1 -0
- package/cjs/glyph/link-path.d.ts +7 -0
- package/cjs/glyph/link-path.js +138 -0
- package/cjs/glyph/link-path.js.map +1 -0
- package/cjs/glyph/ripple.d.ts +1 -0
- package/cjs/glyph/ripple.js +44 -0
- package/cjs/glyph/ripple.js.map +1 -0
- package/cjs/glyph/tree-path.d.ts +7 -0
- package/cjs/glyph/tree-path.js +152 -0
- package/cjs/glyph/tree-path.js.map +1 -0
- package/cjs/glyph/violin.d.ts +1 -0
- package/cjs/glyph/violin.js +165 -0
- package/cjs/glyph/violin.js.map +1 -0
- package/cjs/glyph/wave.d.ts +1 -0
- package/cjs/glyph/wave.js +67 -0
- package/cjs/glyph/wave.js.map +1 -0
- package/cjs/graph/animation/animate.d.ts +48 -0
- package/cjs/graph/animation/animate.js +250 -0
- package/cjs/graph/animation/animate.js.map +1 -0
- package/cjs/graph/animation/animation/clip.d.ts +4 -0
- package/cjs/graph/animation/animation/clip.js +54 -0
- package/cjs/graph/animation/animation/clip.js.map +1 -0
- package/cjs/graph/animation/animation/fade.d.ts +4 -0
- package/cjs/graph/animation/animation/fade.js +42 -0
- package/cjs/graph/animation/animation/fade.js.map +1 -0
- package/cjs/graph/animation/animation/grow-cartesian.d.ts +7 -0
- package/cjs/graph/animation/animation/grow-cartesian.js +288 -0
- package/cjs/graph/animation/animation/grow-cartesian.js.map +1 -0
- package/cjs/graph/animation/animation/grow-interval.d.ts +3 -0
- package/cjs/graph/animation/animation/grow-interval.js +194 -0
- package/cjs/graph/animation/animation/grow-interval.js.map +1 -0
- package/cjs/graph/animation/animation/grow-points.d.ts +7 -0
- package/cjs/graph/animation/animation/grow-points.js +118 -0
- package/cjs/graph/animation/animation/grow-points.js.map +1 -0
- package/cjs/graph/animation/animation/grow-polar.d.ts +5 -0
- package/cjs/graph/animation/animation/grow-polar.js +164 -0
- package/cjs/graph/animation/animation/grow-polar.js.map +1 -0
- package/cjs/graph/animation/animation/index.d.ts +11 -0
- package/cjs/graph/animation/animation/index.js +191 -0
- package/cjs/graph/animation/animation/index.js.map +1 -0
- package/cjs/graph/animation/animation/move.d.ts +3 -0
- package/cjs/graph/animation/animation/move.js +90 -0
- package/cjs/graph/animation/animation/move.js.map +1 -0
- package/cjs/graph/animation/animation/rotate.d.ts +3 -0
- package/cjs/graph/animation/animation/rotate.js +42 -0
- package/cjs/graph/animation/animation/rotate.js.map +1 -0
- package/cjs/graph/animation/animation/scale.d.ts +3 -0
- package/cjs/graph/animation/animation/scale.js +84 -0
- package/cjs/graph/animation/animation/scale.js.map +1 -0
- package/cjs/graph/animation/animation/update.d.ts +6 -0
- package/cjs/graph/animation/animation/update.js +22 -0
- package/cjs/graph/animation/animation/update.js.map +1 -0
- package/cjs/graph/animation/animator.d.ts +26 -0
- package/cjs/graph/animation/animator.js +88 -0
- package/cjs/graph/animation/animator.js.map +1 -0
- package/cjs/graph/animation/arranger.d.ts +13 -0
- package/cjs/graph/animation/arranger.js +38 -0
- package/cjs/graph/animation/arranger.js.map +1 -0
- package/cjs/graph/animation/attribute.d.ts +27 -0
- package/cjs/graph/animation/attribute.js +124 -0
- package/cjs/graph/animation/attribute.js.map +1 -0
- package/cjs/graph/animation/config.d.ts +5 -0
- package/cjs/graph/animation/config.js +92 -0
- package/cjs/graph/animation/config.js.map +1 -0
- package/cjs/graph/animation/morph.d.ts +12 -0
- package/cjs/graph/animation/morph.js +174 -0
- package/cjs/graph/animation/morph.js.map +1 -0
- package/cjs/graph/attributes/common.d.ts +2 -0
- package/cjs/graph/attributes/common.js +22 -0
- package/cjs/graph/attributes/common.js.map +1 -0
- package/cjs/graph/attributes/helpers.d.ts +17 -0
- package/cjs/graph/attributes/helpers.js +86 -0
- package/cjs/graph/attributes/helpers.js.map +1 -0
- package/cjs/graph/attributes/index.d.ts +10 -0
- package/cjs/graph/attributes/index.js +257 -0
- package/cjs/graph/attributes/index.js.map +1 -0
- package/cjs/graph/canvas-renderer.d.ts +34 -0
- package/cjs/graph/canvas-renderer.js +121 -0
- package/cjs/graph/canvas-renderer.js.map +1 -0
- package/cjs/graph/constants.d.ts +23 -0
- package/cjs/graph/constants.js +21 -0
- package/cjs/graph/constants.js.map +1 -0
- package/cjs/graph/element.d.ts +66 -0
- package/cjs/graph/element.js +297 -0
- package/cjs/graph/element.js.map +1 -0
- package/cjs/graph/enums.d.ts +153 -0
- package/cjs/graph/enums.js +85 -0
- package/cjs/graph/enums.js.map +1 -0
- package/cjs/graph/glyph-element.d.ts +53 -0
- package/cjs/graph/glyph-element.js +202 -0
- package/cjs/graph/glyph-element.js.map +1 -0
- package/cjs/graph/index.d.ts +3 -0
- package/cjs/graph/index.js +44 -0
- package/cjs/graph/index.js.map +1 -0
- package/cjs/graph/layout/grid.d.ts +3 -0
- package/cjs/graph/layout/grid.js +75 -0
- package/cjs/graph/layout/grid.js.map +1 -0
- package/cjs/graph/layout/layout.d.ts +3 -0
- package/cjs/graph/layout/layout.js +33 -0
- package/cjs/graph/layout/layout.js.map +1 -0
- package/cjs/graph/layout/relative.d.ts +3 -0
- package/cjs/graph/layout/relative.js +86 -0
- package/cjs/graph/layout/relative.js.map +1 -0
- package/cjs/graph/mark/differ.d.ts +20 -0
- package/cjs/graph/mark/differ.js +110 -0
- package/cjs/graph/mark/differ.js.map +1 -0
- package/cjs/graph/mark/encode.d.ts +10 -0
- package/cjs/graph/mark/encode.js +95 -0
- package/cjs/graph/mark/encode.js.map +1 -0
- package/cjs/graph/mark/large-rects.d.ts +10 -0
- package/cjs/graph/mark/large-rects.js +31 -0
- package/cjs/graph/mark/large-rects.js.map +1 -0
- package/cjs/graph/mark/large-symbols.d.ts +11 -0
- package/cjs/graph/mark/large-symbols.js +33 -0
- package/cjs/graph/mark/large-symbols.js.map +1 -0
- package/cjs/graph/mark-tree.d.ts +2 -0
- package/cjs/graph/mark-tree.js +21 -0
- package/cjs/graph/mark-tree.js.map +1 -0
- package/cjs/graph/util/element.d.ts +2 -0
- package/cjs/graph/util/element.js +10 -0
- package/cjs/graph/util/element.js.map +1 -0
- package/cjs/graph/util/env.d.ts +2 -0
- package/cjs/graph/util/env.js +14 -0
- package/cjs/graph/util/env.js.map +1 -0
- package/cjs/graph/util/events-extend.d.ts +5 -0
- package/cjs/graph/util/events-extend.js +18 -0
- package/cjs/graph/util/events-extend.js.map +1 -0
- package/cjs/graph/util/graphic.d.ts +9 -0
- package/cjs/graph/util/graphic.js +59 -0
- package/cjs/graph/util/graphic.js.map +1 -0
- package/cjs/graph/util/point.d.ts +1 -0
- package/cjs/graph/util/point.js +75 -0
- package/cjs/graph/util/point.js.map +1 -0
- package/cjs/index.d.ts +14 -0
- package/cjs/index.js +111 -0
- package/cjs/index.js.map +1 -0
- package/cjs/parse/coordinate.d.ts +7 -0
- package/cjs/parse/coordinate.js +70 -0
- package/cjs/parse/coordinate.js.map +1 -0
- package/cjs/parse/event.d.ts +8 -0
- package/cjs/parse/event.js +33 -0
- package/cjs/parse/event.js.map +1 -0
- package/cjs/parse/mark.d.ts +4 -0
- package/cjs/parse/mark.js +25 -0
- package/cjs/parse/mark.js.map +1 -0
- package/cjs/parse/option.d.ts +3 -0
- package/cjs/parse/option.js +19 -0
- package/cjs/parse/option.js.map +1 -0
- package/cjs/parse/scale.d.ts +8 -0
- package/cjs/parse/scale.js +365 -0
- package/cjs/parse/scale.js.map +1 -0
- package/cjs/parse/transform.d.ts +5 -0
- package/cjs/parse/transform.js +103 -0
- package/cjs/parse/transform.js.map +1 -0
- package/cjs/parse/util.d.ts +13 -0
- package/cjs/parse/util.js +82 -0
- package/cjs/parse/util.js.map +1 -0
- package/cjs/parse/view.d.ts +17 -0
- package/cjs/parse/view.js +108 -0
- package/cjs/parse/view.js.map +1 -0
- package/cjs/semantic-marks/cell.d.ts +13 -0
- package/cjs/semantic-marks/cell.js +61 -0
- package/cjs/semantic-marks/cell.js.map +1 -0
- package/cjs/semantic-marks/interval.d.ts +14 -0
- package/cjs/semantic-marks/interval.js +80 -0
- package/cjs/semantic-marks/interval.js.map +1 -0
- package/cjs/semantic-marks/text.d.ts +10 -0
- package/cjs/semantic-marks/text.js +25 -0
- package/cjs/semantic-marks/text.js.map +1 -0
- package/cjs/theme/common/component.d.ts +15 -0
- package/cjs/theme/common/component.js +493 -0
- package/cjs/theme/common/component.js.map +1 -0
- package/cjs/theme/common/constants.d.ts +1 -0
- package/cjs/theme/common/constants.js +6 -0
- package/cjs/theme/common/constants.js.map +1 -0
- package/cjs/theme/common/mark.d.ts +2 -0
- package/cjs/theme/common/mark.js +15 -0
- package/cjs/theme/common/mark.js.map +1 -0
- package/cjs/theme/dark.d.ts +2 -0
- package/cjs/theme/dark.js +94 -0
- package/cjs/theme/dark.js.map +1 -0
- package/cjs/theme/default.d.ts +2 -0
- package/cjs/theme/default.js +18 -0
- package/cjs/theme/default.js.map +1 -0
- package/cjs/theme/theme-manager.d.ts +8 -0
- package/cjs/theme/theme-manager.js +26 -0
- package/cjs/theme/theme-manager.js.map +1 -0
- package/cjs/transforms/data/bin.d.ts +2 -0
- package/cjs/transforms/data/bin.js +21 -0
- package/cjs/transforms/data/bin.js.map +1 -0
- package/cjs/transforms/data/circular-relation.d.ts +2 -0
- package/cjs/transforms/data/circular-relation.js +56 -0
- package/cjs/transforms/data/circular-relation.js.map +1 -0
- package/cjs/transforms/data/contour.d.ts +2 -0
- package/cjs/transforms/data/contour.js +115 -0
- package/cjs/transforms/data/contour.js.map +1 -0
- package/cjs/transforms/data/filter.d.ts +2 -0
- package/cjs/transforms/data/filter.js +10 -0
- package/cjs/transforms/data/filter.js.map +1 -0
- package/cjs/transforms/data/fold.d.ts +2 -0
- package/cjs/transforms/data/fold.js +24 -0
- package/cjs/transforms/data/fold.js.map +1 -0
- package/cjs/transforms/data/funnel.d.ts +2 -0
- package/cjs/transforms/data/funnel.js +25 -0
- package/cjs/transforms/data/funnel.js.map +1 -0
- package/cjs/transforms/data/join.d.ts +2 -0
- package/cjs/transforms/data/join.js +33 -0
- package/cjs/transforms/data/join.js.map +1 -0
- package/cjs/transforms/data/kde.d.ts +2 -0
- package/cjs/transforms/data/kde.js +90 -0
- package/cjs/transforms/data/kde.js.map +1 -0
- package/cjs/transforms/data/map.d.ts +2 -0
- package/cjs/transforms/data/map.js +23 -0
- package/cjs/transforms/data/map.js.map +1 -0
- package/cjs/transforms/data/pick.d.ts +2 -0
- package/cjs/transforms/data/pick.js +20 -0
- package/cjs/transforms/data/pick.js.map +1 -0
- package/cjs/transforms/data/pie.d.ts +2 -0
- package/cjs/transforms/data/pie.js +24 -0
- package/cjs/transforms/data/pie.js.map +1 -0
- package/cjs/transforms/data/range.d.ts +4 -0
- package/cjs/transforms/data/range.js +15 -0
- package/cjs/transforms/data/range.js.map +1 -0
- package/cjs/transforms/data/sort.d.ts +2 -0
- package/cjs/transforms/data/sort.js +17 -0
- package/cjs/transforms/data/sort.js.map +1 -0
- package/cjs/transforms/data/stack.d.ts +2 -0
- package/cjs/transforms/data/stack.js +74 -0
- package/cjs/transforms/data/stack.js.map +1 -0
- package/cjs/transforms/data/unfold.d.ts +2 -0
- package/cjs/transforms/data/unfold.js +49 -0
- package/cjs/transforms/data/unfold.js.map +1 -0
- package/cjs/transforms/index.d.ts +23 -0
- package/cjs/transforms/index.js +213 -0
- package/cjs/transforms/index.js.map +1 -0
- package/cjs/transforms/mark/dodge.d.ts +2 -0
- package/cjs/transforms/mark/dodge.js +81 -0
- package/cjs/transforms/mark/dodge.js.map +1 -0
- package/cjs/transforms/mark/jitter.d.ts +4 -0
- package/cjs/transforms/mark/jitter.js +53 -0
- package/cjs/transforms/mark/jitter.js.map +1 -0
- package/cjs/transforms/mark/lttb-sample.d.ts +2 -0
- package/cjs/transforms/mark/lttb-sample.js +68 -0
- package/cjs/transforms/mark/lttb-sample.js.map +1 -0
- package/cjs/transforms/mark/mark-overlap.d.ts +2 -0
- package/cjs/transforms/mark/mark-overlap.js +79 -0
- package/cjs/transforms/mark/mark-overlap.js.map +1 -0
- package/cjs/transforms/mark/symmetry.d.ts +2 -0
- package/cjs/transforms/mark/symmetry.js +25 -0
- package/cjs/transforms/mark/symmetry.js.map +1 -0
- package/cjs/transforms/util/util.d.ts +5 -0
- package/cjs/transforms/util/util.js +41 -0
- package/cjs/transforms/util/util.js.map +1 -0
- package/cjs/transforms/view/identifier.d.ts +2 -0
- package/cjs/transforms/view/identifier.js +17 -0
- package/cjs/transforms/view/identifier.js.map +1 -0
- package/cjs/types/animate.d.ts +224 -0
- package/cjs/types/animate.js +6 -0
- package/cjs/types/animate.js.map +1 -0
- package/cjs/types/base.d.ts +36 -0
- package/cjs/types/base.js +6 -0
- package/cjs/types/base.js.map +1 -0
- package/cjs/types/component.d.ts +240 -0
- package/cjs/types/component.js +6 -0
- package/cjs/types/component.js.map +1 -0
- package/cjs/types/coordinate.d.ts +15 -0
- package/cjs/types/coordinate.js +6 -0
- package/cjs/types/coordinate.js.map +1 -0
- package/cjs/types/data.d.ts +55 -0
- package/cjs/types/data.js +5 -0
- package/cjs/types/data.js.map +1 -0
- package/cjs/types/dataflow.d.ts +13 -0
- package/cjs/types/dataflow.js +6 -0
- package/cjs/types/dataflow.js.map +1 -0
- package/cjs/types/element.d.ts +117 -0
- package/cjs/types/element.js +6 -0
- package/cjs/types/element.js.map +1 -0
- package/cjs/types/event.d.ts +58 -0
- package/cjs/types/event.js +6 -0
- package/cjs/types/event.js.map +1 -0
- package/cjs/types/glyph.d.ts +29 -0
- package/cjs/types/glyph.js +6 -0
- package/cjs/types/glyph.js.map +1 -0
- package/cjs/types/grammar.d.ts +184 -0
- package/cjs/types/grammar.js +6 -0
- package/cjs/types/grammar.js.map +1 -0
- package/cjs/types/hooks.d.ts +45 -0
- package/cjs/types/hooks.js +6 -0
- package/cjs/types/hooks.js.map +1 -0
- package/cjs/types/index.d.ts +22 -0
- package/cjs/types/index.js +31 -0
- package/cjs/types/index.js.map +1 -0
- package/cjs/types/layout.d.ts +5 -0
- package/cjs/types/layout.js +6 -0
- package/cjs/types/layout.js.map +1 -0
- package/cjs/types/mark.d.ts +344 -0
- package/cjs/types/mark.js +6 -0
- package/cjs/types/mark.js.map +1 -0
- package/cjs/types/morph.d.ts +29 -0
- package/cjs/types/morph.js +6 -0
- package/cjs/types/morph.js.map +1 -0
- package/cjs/types/plot.d.ts +326 -0
- package/cjs/types/plot.js +6 -0
- package/cjs/types/plot.js.map +1 -0
- package/cjs/types/projection.d.ts +61 -0
- package/cjs/types/projection.js +6 -0
- package/cjs/types/projection.js.map +1 -0
- package/cjs/types/renderer.d.ts +19 -0
- package/cjs/types/renderer.js +6 -0
- package/cjs/types/renderer.js.map +1 -0
- package/cjs/types/scale.d.ts +111 -0
- package/cjs/types/scale.js +6 -0
- package/cjs/types/scale.js.map +1 -0
- package/cjs/types/signal.d.ts +20 -0
- package/cjs/types/signal.js +6 -0
- package/cjs/types/signal.js.map +1 -0
- package/cjs/types/theme.d.ts +41 -0
- package/cjs/types/theme.js +6 -0
- package/cjs/types/theme.js.map +1 -0
- package/cjs/types/transform.d.ts +291 -0
- package/cjs/types/transform.js +6 -0
- package/cjs/types/transform.js.map +1 -0
- package/cjs/types/view.d.ts +217 -0
- package/cjs/types/view.js +6 -0
- package/cjs/types/view.js.map +1 -0
- package/cjs/util/data.d.ts +3 -0
- package/cjs/util/data.js +64 -0
- package/cjs/util/data.js.map +1 -0
- package/cjs/util/grammar-heap.d.ts +14 -0
- package/cjs/util/grammar-heap.js +66 -0
- package/cjs/util/grammar-heap.js.map +1 -0
- package/cjs/util/text.d.ts +19 -0
- package/cjs/util/text.js +32 -0
- package/cjs/util/text.js.map +1 -0
- package/cjs/util/unique-list.d.ts +12 -0
- package/cjs/util/unique-list.js +37 -0
- package/cjs/util/unique-list.js.map +1 -0
- package/cjs/view/View.d.ts +157 -0
- package/cjs/view/View.js +800 -0
- package/cjs/view/View.js.map +1 -0
- package/cjs/view/animate.d.ts +20 -0
- package/cjs/view/animate.js +106 -0
- package/cjs/view/animate.js.map +1 -0
- package/cjs/view/component.d.ts +26 -0
- package/cjs/view/component.js +64 -0
- package/cjs/view/component.js.map +1 -0
- package/cjs/view/constants.d.ts +17 -0
- package/cjs/view/constants.js +13 -0
- package/cjs/view/constants.js.map +1 -0
- package/cjs/view/coordinate.d.ts +23 -0
- package/cjs/view/coordinate.js +59 -0
- package/cjs/view/coordinate.js.map +1 -0
- package/cjs/view/data.d.ts +37 -0
- package/cjs/view/data.js +198 -0
- package/cjs/view/data.js.map +1 -0
- package/cjs/view/dataflow.d.ts +32 -0
- package/cjs/view/dataflow.js +146 -0
- package/cjs/view/dataflow.js.map +1 -0
- package/cjs/view/events.d.ts +4 -0
- package/cjs/view/events.js +34 -0
- package/cjs/view/events.js.map +1 -0
- package/cjs/view/glyph-meta.d.ts +29 -0
- package/cjs/view/glyph-meta.js +45 -0
- package/cjs/view/glyph-meta.js.map +1 -0
- package/cjs/view/glyph.d.ts +14 -0
- package/cjs/view/glyph.js +29 -0
- package/cjs/view/glyph.js.map +1 -0
- package/cjs/view/grammar-base.d.ts +46 -0
- package/cjs/view/grammar-base.js +171 -0
- package/cjs/view/grammar-base.js.map +1 -0
- package/cjs/view/grammar-record.d.ts +39 -0
- package/cjs/view/grammar-record.js +180 -0
- package/cjs/view/grammar-record.js.map +1 -0
- package/cjs/view/group.d.ts +13 -0
- package/cjs/view/group.js +39 -0
- package/cjs/view/group.js.map +1 -0
- package/cjs/view/index.d.ts +1 -0
- package/cjs/view/index.js +21 -0
- package/cjs/view/index.js.map +1 -0
- package/cjs/view/mark.d.ts +112 -0
- package/cjs/view/mark.js +600 -0
- package/cjs/view/mark.js.map +1 -0
- package/cjs/view/scale.d.ts +26 -0
- package/cjs/view/scale.js +86 -0
- package/cjs/view/scale.js.map +1 -0
- package/cjs/view/signal.d.ts +18 -0
- package/cjs/view/signal.js +56 -0
- package/cjs/view/signal.js.map +1 -0
- package/es/component/axis.d.ts +26 -0
- package/es/component/axis.js +162 -0
- package/es/component/axis.js.map +1 -0
- package/es/component/crosshair.d.ts +50 -0
- package/es/component/crosshair.js +275 -0
- package/es/component/crosshair.js.map +1 -0
- package/es/component/datazoom.d.ts +19 -0
- package/es/component/datazoom.js +161 -0
- package/es/component/datazoom.js.map +1 -0
- package/es/component/grid.d.ts +27 -0
- package/es/component/grid.js +193 -0
- package/es/component/grid.js.map +1 -0
- package/es/component/index.d.ts +11 -0
- package/es/component/index.js +22 -0
- package/es/component/index.js.map +1 -0
- package/es/component/label.d.ts +19 -0
- package/es/component/label.js +124 -0
- package/es/component/label.js.map +1 -0
- package/es/component/legend.d.ts +26 -0
- package/es/component/legend.js +169 -0
- package/es/component/legend.js.map +1 -0
- package/es/component/player.d.ts +25 -0
- package/es/component/player.js +136 -0
- package/es/component/player.js.map +1 -0
- package/es/component/scale.d.ts +8 -0
- package/es/component/scale.js +19 -0
- package/es/component/scale.js.map +1 -0
- package/es/component/scrollbar.d.ts +23 -0
- package/es/component/scrollbar.js +184 -0
- package/es/component/scrollbar.js.map +1 -0
- package/es/component/slider.d.ts +19 -0
- package/es/component/slider.js +86 -0
- package/es/component/slider.js.map +1 -0
- package/es/component/title.d.ts +15 -0
- package/es/component/title.js +58 -0
- package/es/component/title.js.map +1 -0
- package/es/component/tooltip.d.ts +62 -0
- package/es/component/tooltip.js +303 -0
- package/es/component/tooltip.js.map +1 -0
- package/es/core/factory.d.ts +35 -0
- package/es/core/factory.js +67 -0
- package/es/core/factory.js.map +1 -0
- package/es/glyph/boxplot.d.ts +10 -0
- package/es/glyph/boxplot.js +410 -0
- package/es/glyph/boxplot.js.map +1 -0
- package/es/glyph/index.d.ts +7 -0
- package/es/glyph/index.js +11 -0
- package/es/glyph/index.js.map +1 -0
- package/es/glyph/link-path.d.ts +7 -0
- package/es/glyph/link-path.js +132 -0
- package/es/glyph/link-path.js.map +1 -0
- package/es/glyph/ripple.d.ts +1 -0
- package/es/glyph/ripple.js +38 -0
- package/es/glyph/ripple.js.map +1 -0
- package/es/glyph/tree-path.d.ts +7 -0
- package/es/glyph/tree-path.js +146 -0
- package/es/glyph/tree-path.js.map +1 -0
- package/es/glyph/violin.d.ts +1 -0
- package/es/glyph/violin.js +163 -0
- package/es/glyph/violin.js.map +1 -0
- package/es/glyph/wave.d.ts +1 -0
- package/es/glyph/wave.js +61 -0
- package/es/glyph/wave.js.map +1 -0
- package/es/graph/animation/animate.d.ts +48 -0
- package/es/graph/animation/animate.js +247 -0
- package/es/graph/animation/animate.js.map +1 -0
- package/es/graph/animation/animation/clip.d.ts +4 -0
- package/es/graph/animation/animation/clip.js +44 -0
- package/es/graph/animation/animation/clip.js.map +1 -0
- package/es/graph/animation/animation/fade.d.ts +4 -0
- package/es/graph/animation/animation/fade.js +32 -0
- package/es/graph/animation/animation/fade.js.map +1 -0
- package/es/graph/animation/animation/grow-cartesian.d.ts +7 -0
- package/es/graph/animation/animation/grow-cartesian.js +272 -0
- package/es/graph/animation/animation/grow-cartesian.js.map +1 -0
- package/es/graph/animation/animation/grow-interval.d.ts +3 -0
- package/es/graph/animation/animation/grow-interval.js +184 -0
- package/es/graph/animation/animation/grow-interval.js.map +1 -0
- package/es/graph/animation/animation/grow-points.d.ts +7 -0
- package/es/graph/animation/animation/grow-points.js +107 -0
- package/es/graph/animation/animation/grow-points.js.map +1 -0
- package/es/graph/animation/animation/grow-polar.d.ts +5 -0
- package/es/graph/animation/animation/grow-polar.js +160 -0
- package/es/graph/animation/animation/grow-polar.js.map +1 -0
- package/es/graph/animation/animation/index.d.ts +11 -0
- package/es/graph/animation/animation/index.js +22 -0
- package/es/graph/animation/animation/index.js.map +1 -0
- package/es/graph/animation/animation/move.d.ts +3 -0
- package/es/graph/animation/animation/move.js +78 -0
- package/es/graph/animation/animation/move.js.map +1 -0
- package/es/graph/animation/animation/rotate.d.ts +3 -0
- package/es/graph/animation/animation/rotate.js +32 -0
- package/es/graph/animation/animation/rotate.js.map +1 -0
- package/es/graph/animation/animation/scale.d.ts +3 -0
- package/es/graph/animation/animation/scale.js +74 -0
- package/es/graph/animation/animation/scale.js.map +1 -0
- package/es/graph/animation/animation/update.d.ts +6 -0
- package/es/graph/animation/animation/update.js +20 -0
- package/es/graph/animation/animation/update.js.map +1 -0
- package/es/graph/animation/animator.d.ts +26 -0
- package/es/graph/animation/animator.js +83 -0
- package/es/graph/animation/animator.js.map +1 -0
- package/es/graph/animation/arranger.d.ts +13 -0
- package/es/graph/animation/arranger.js +29 -0
- package/es/graph/animation/arranger.js.map +1 -0
- package/es/graph/animation/attribute.d.ts +27 -0
- package/es/graph/animation/attribute.js +114 -0
- package/es/graph/animation/attribute.js.map +1 -0
- package/es/graph/animation/config.d.ts +5 -0
- package/es/graph/animation/config.js +84 -0
- package/es/graph/animation/config.js.map +1 -0
- package/es/graph/animation/morph.d.ts +12 -0
- package/es/graph/animation/morph.js +171 -0
- package/es/graph/animation/morph.js.map +1 -0
- package/es/graph/attributes/common.d.ts +2 -0
- package/es/graph/attributes/common.js +13 -0
- package/es/graph/attributes/common.js.map +1 -0
- package/es/graph/attributes/helpers.d.ts +17 -0
- package/es/graph/attributes/helpers.js +75 -0
- package/es/graph/attributes/helpers.js.map +1 -0
- package/es/graph/attributes/index.d.ts +10 -0
- package/es/graph/attributes/index.js +231 -0
- package/es/graph/attributes/index.js.map +1 -0
- package/es/graph/canvas-renderer.d.ts +34 -0
- package/es/graph/canvas-renderer.js +115 -0
- package/es/graph/canvas-renderer.js.map +1 -0
- package/es/graph/constants.d.ts +23 -0
- package/es/graph/constants.js +47 -0
- package/es/graph/constants.js.map +1 -0
- package/es/graph/element.d.ts +66 -0
- package/es/graph/element.js +292 -0
- package/es/graph/element.js.map +1 -0
- package/es/graph/enums.d.ts +153 -0
- package/es/graph/enums.js +129 -0
- package/es/graph/enums.js.map +1 -0
- package/es/graph/glyph-element.d.ts +53 -0
- package/es/graph/glyph-element.js +206 -0
- package/es/graph/glyph-element.js.map +1 -0
- package/es/graph/index.d.ts +3 -0
- package/es/graph/index.js +6 -0
- package/es/graph/index.js.map +1 -0
- package/es/graph/layout/grid.d.ts +3 -0
- package/es/graph/layout/grid.js +66 -0
- package/es/graph/layout/grid.js.map +1 -0
- package/es/graph/layout/layout.d.ts +3 -0
- package/es/graph/layout/layout.js +33 -0
- package/es/graph/layout/layout.js.map +1 -0
- package/es/graph/layout/relative.d.ts +3 -0
- package/es/graph/layout/relative.js +85 -0
- package/es/graph/layout/relative.js.map +1 -0
- package/es/graph/mark/differ.d.ts +20 -0
- package/es/graph/mark/differ.js +104 -0
- package/es/graph/mark/differ.js.map +1 -0
- package/es/graph/mark/encode.d.ts +10 -0
- package/es/graph/mark/encode.js +92 -0
- package/es/graph/mark/encode.js.map +1 -0
- package/es/graph/mark/large-rects.d.ts +10 -0
- package/es/graph/mark/large-rects.js +23 -0
- package/es/graph/mark/large-rects.js.map +1 -0
- package/es/graph/mark/large-symbols.d.ts +11 -0
- package/es/graph/mark/large-symbols.js +27 -0
- package/es/graph/mark/large-symbols.js.map +1 -0
- package/es/graph/mark-tree.d.ts +2 -0
- package/es/graph/mark-tree.js +15 -0
- package/es/graph/mark-tree.js.map +1 -0
- package/es/graph/util/element.d.ts +2 -0
- package/es/graph/util/element.js +8 -0
- package/es/graph/util/element.js.map +1 -0
- package/es/graph/util/env.d.ts +2 -0
- package/es/graph/util/env.js +6 -0
- package/es/graph/util/env.js.map +1 -0
- package/es/graph/util/events-extend.d.ts +5 -0
- package/es/graph/util/events-extend.js +12 -0
- package/es/graph/util/events-extend.js.map +1 -0
- package/es/graph/util/graphic.d.ts +9 -0
- package/es/graph/util/graphic.js +59 -0
- package/es/graph/util/graphic.js.map +1 -0
- package/es/graph/util/point.d.ts +1 -0
- package/es/graph/util/point.js +67 -0
- package/es/graph/util/point.js.map +1 -0
- package/es/index.d.ts +14 -0
- package/es/index.js +27 -0
- package/es/index.js.map +1 -0
- package/es/parse/coordinate.d.ts +7 -0
- package/es/parse/coordinate.js +65 -0
- package/es/parse/coordinate.js.map +1 -0
- package/es/parse/event.d.ts +8 -0
- package/es/parse/event.js +23 -0
- package/es/parse/event.js.map +1 -0
- package/es/parse/mark.d.ts +4 -0
- package/es/parse/mark.js +19 -0
- package/es/parse/mark.js.map +1 -0
- package/es/parse/option.d.ts +3 -0
- package/es/parse/option.js +10 -0
- package/es/parse/option.js.map +1 -0
- package/es/parse/scale.d.ts +8 -0
- package/es/parse/scale.js +347 -0
- package/es/parse/scale.js.map +1 -0
- package/es/parse/transform.d.ts +5 -0
- package/es/parse/transform.js +102 -0
- package/es/parse/transform.js.map +1 -0
- package/es/parse/util.d.ts +13 -0
- package/es/parse/util.js +65 -0
- package/es/parse/util.js.map +1 -0
- package/es/parse/view.d.ts +17 -0
- package/es/parse/view.js +98 -0
- package/es/parse/view.js.map +1 -0
- package/es/semantic-marks/cell.d.ts +13 -0
- package/es/semantic-marks/cell.js +57 -0
- package/es/semantic-marks/cell.js.map +1 -0
- package/es/semantic-marks/interval.d.ts +14 -0
- package/es/semantic-marks/interval.js +87 -0
- package/es/semantic-marks/interval.js.map +1 -0
- package/es/semantic-marks/text.d.ts +10 -0
- package/es/semantic-marks/text.js +22 -0
- package/es/semantic-marks/text.js.map +1 -0
- package/es/theme/common/component.d.ts +15 -0
- package/es/theme/common/component.js +510 -0
- package/es/theme/common/component.js.map +1 -0
- package/es/theme/common/constants.d.ts +1 -0
- package/es/theme/common/constants.js +2 -0
- package/es/theme/common/constants.js.map +1 -0
- package/es/theme/common/mark.d.ts +2 -0
- package/es/theme/common/mark.js +11 -0
- package/es/theme/common/mark.js.map +1 -0
- package/es/theme/dark.d.ts +2 -0
- package/es/theme/dark.js +96 -0
- package/es/theme/dark.js.map +1 -0
- package/es/theme/default.d.ts +2 -0
- package/es/theme/default.js +16 -0
- package/es/theme/default.js.map +1 -0
- package/es/theme/theme-manager.d.ts +8 -0
- package/es/theme/theme-manager.js +22 -0
- package/es/theme/theme-manager.js.map +1 -0
- package/es/transforms/data/bin.d.ts +2 -0
- package/es/transforms/data/bin.js +16 -0
- package/es/transforms/data/bin.js.map +1 -0
- package/es/transforms/data/circular-relation.d.ts +2 -0
- package/es/transforms/data/circular-relation.js +44 -0
- package/es/transforms/data/circular-relation.js.map +1 -0
- package/es/transforms/data/contour.d.ts +2 -0
- package/es/transforms/data/contour.js +111 -0
- package/es/transforms/data/contour.js.map +1 -0
- package/es/transforms/data/filter.d.ts +2 -0
- package/es/transforms/data/filter.js +2 -0
- package/es/transforms/data/filter.js.map +1 -0
- package/es/transforms/data/fold.d.ts +2 -0
- package/es/transforms/data/fold.js +16 -0
- package/es/transforms/data/fold.js.map +1 -0
- package/es/transforms/data/funnel.d.ts +2 -0
- package/es/transforms/data/funnel.js +17 -0
- package/es/transforms/data/funnel.js.map +1 -0
- package/es/transforms/data/join.d.ts +2 -0
- package/es/transforms/data/join.js +26 -0
- package/es/transforms/data/join.js.map +1 -0
- package/es/transforms/data/kde.d.ts +2 -0
- package/es/transforms/data/kde.js +80 -0
- package/es/transforms/data/kde.js.map +1 -0
- package/es/transforms/data/map.d.ts +2 -0
- package/es/transforms/data/map.js +16 -0
- package/es/transforms/data/map.js.map +1 -0
- package/es/transforms/data/pick.d.ts +2 -0
- package/es/transforms/data/pick.js +15 -0
- package/es/transforms/data/pick.js.map +1 -0
- package/es/transforms/data/pie.d.ts +2 -0
- package/es/transforms/data/pie.js +18 -0
- package/es/transforms/data/pie.js.map +1 -0
- package/es/transforms/data/range.d.ts +4 -0
- package/es/transforms/data/range.js +9 -0
- package/es/transforms/data/range.js.map +1 -0
- package/es/transforms/data/sort.d.ts +2 -0
- package/es/transforms/data/sort.js +13 -0
- package/es/transforms/data/sort.js.map +1 -0
- package/es/transforms/data/stack.d.ts +2 -0
- package/es/transforms/data/stack.js +72 -0
- package/es/transforms/data/stack.js.map +1 -0
- package/es/transforms/data/unfold.d.ts +2 -0
- package/es/transforms/data/unfold.js +45 -0
- package/es/transforms/data/unfold.js.map +1 -0
- package/es/transforms/index.d.ts +23 -0
- package/es/transforms/index.js +205 -0
- package/es/transforms/index.js.map +1 -0
- package/es/transforms/mark/dodge.d.ts +2 -0
- package/es/transforms/mark/dodge.js +74 -0
- package/es/transforms/mark/dodge.js.map +1 -0
- package/es/transforms/mark/jitter.d.ts +4 -0
- package/es/transforms/mark/jitter.js +48 -0
- package/es/transforms/mark/jitter.js.map +1 -0
- package/es/transforms/mark/lttb-sample.d.ts +2 -0
- package/es/transforms/mark/lttb-sample.js +60 -0
- package/es/transforms/mark/lttb-sample.js.map +1 -0
- package/es/transforms/mark/mark-overlap.d.ts +2 -0
- package/es/transforms/mark/mark-overlap.js +71 -0
- package/es/transforms/mark/mark-overlap.js.map +1 -0
- package/es/transforms/mark/symmetry.d.ts +2 -0
- package/es/transforms/mark/symmetry.js +20 -0
- package/es/transforms/mark/symmetry.js.map +1 -0
- package/es/transforms/util/util.d.ts +5 -0
- package/es/transforms/util/util.js +33 -0
- package/es/transforms/util/util.js.map +1 -0
- package/es/transforms/view/identifier.d.ts +2 -0
- package/es/transforms/view/identifier.js +13 -0
- package/es/transforms/view/identifier.js.map +1 -0
- package/es/types/animate.d.ts +224 -0
- package/es/types/animate.js +2 -0
- package/es/types/animate.js.map +1 -0
- package/es/types/base.d.ts +36 -0
- package/es/types/base.js +2 -0
- package/es/types/base.js.map +1 -0
- package/es/types/component.d.ts +240 -0
- package/es/types/component.js +2 -0
- package/es/types/component.js.map +1 -0
- package/es/types/coordinate.d.ts +15 -0
- package/es/types/coordinate.js +2 -0
- package/es/types/coordinate.js.map +1 -0
- package/es/types/data.d.ts +55 -0
- package/es/types/data.js +1 -0
- package/es/types/data.js.map +1 -0
- package/es/types/dataflow.d.ts +13 -0
- package/es/types/dataflow.js +2 -0
- package/es/types/dataflow.js.map +1 -0
- package/es/types/element.d.ts +117 -0
- package/es/types/element.js +2 -0
- package/es/types/element.js.map +1 -0
- package/es/types/event.d.ts +58 -0
- package/es/types/event.js +2 -0
- package/es/types/event.js.map +1 -0
- package/es/types/glyph.d.ts +29 -0
- package/es/types/glyph.js +2 -0
- package/es/types/glyph.js.map +1 -0
- package/es/types/grammar.d.ts +184 -0
- package/es/types/grammar.js +2 -0
- package/es/types/grammar.js.map +1 -0
- package/es/types/hooks.d.ts +45 -0
- package/es/types/hooks.js +2 -0
- package/es/types/hooks.js.map +1 -0
- package/es/types/index.d.ts +22 -0
- package/es/types/index.js +44 -0
- package/es/types/index.js.map +1 -0
- package/es/types/layout.d.ts +5 -0
- package/es/types/layout.js +2 -0
- package/es/types/layout.js.map +1 -0
- package/es/types/mark.d.ts +344 -0
- package/es/types/mark.js +2 -0
- package/es/types/mark.js.map +1 -0
- package/es/types/morph.d.ts +29 -0
- package/es/types/morph.js +2 -0
- package/es/types/morph.js.map +1 -0
- package/es/types/plot.d.ts +326 -0
- package/es/types/plot.js +2 -0
- package/es/types/plot.js.map +1 -0
- package/es/types/projection.d.ts +61 -0
- package/es/types/projection.js +2 -0
- package/es/types/projection.js.map +1 -0
- package/es/types/renderer.d.ts +19 -0
- package/es/types/renderer.js +2 -0
- package/es/types/renderer.js.map +1 -0
- package/es/types/scale.d.ts +111 -0
- package/es/types/scale.js +2 -0
- package/es/types/scale.js.map +1 -0
- package/es/types/signal.d.ts +20 -0
- package/es/types/signal.js +2 -0
- package/es/types/signal.js.map +1 -0
- package/es/types/theme.d.ts +41 -0
- package/es/types/theme.js +2 -0
- package/es/types/theme.js.map +1 -0
- package/es/types/transform.d.ts +291 -0
- package/es/types/transform.js +2 -0
- package/es/types/transform.js.map +1 -0
- package/es/types/view.d.ts +217 -0
- package/es/types/view.js +2 -0
- package/es/types/view.js.map +1 -0
- package/es/util/data.d.ts +3 -0
- package/es/util/data.js +60 -0
- package/es/util/data.js.map +1 -0
- package/es/util/grammar-heap.d.ts +14 -0
- package/es/util/grammar-heap.js +58 -0
- package/es/util/grammar-heap.js.map +1 -0
- package/es/util/text.d.ts +19 -0
- package/es/util/text.js +25 -0
- package/es/util/text.js.map +1 -0
- package/es/util/unique-list.d.ts +12 -0
- package/es/util/unique-list.js +29 -0
- package/es/util/unique-list.js.map +1 -0
- package/es/view/View.d.ts +157 -0
- package/es/view/View.js +836 -0
- package/es/view/View.js.map +1 -0
- package/es/view/animate.d.ts +20 -0
- package/es/view/animate.js +98 -0
- package/es/view/animate.js.map +1 -0
- package/es/view/component.d.ts +26 -0
- package/es/view/component.js +64 -0
- package/es/view/component.js.map +1 -0
- package/es/view/constants.d.ts +17 -0
- package/es/view/constants.js +32 -0
- package/es/view/constants.js.map +1 -0
- package/es/view/coordinate.d.ts +23 -0
- package/es/view/coordinate.js +52 -0
- package/es/view/coordinate.js.map +1 -0
- package/es/view/data.d.ts +37 -0
- package/es/view/data.js +195 -0
- package/es/view/data.js.map +1 -0
- package/es/view/dataflow.d.ts +32 -0
- package/es/view/dataflow.js +141 -0
- package/es/view/dataflow.js.map +1 -0
- package/es/view/events.d.ts +4 -0
- package/es/view/events.js +26 -0
- package/es/view/events.js.map +1 -0
- package/es/view/glyph-meta.d.ts +29 -0
- package/es/view/glyph-meta.js +37 -0
- package/es/view/glyph-meta.js.map +1 -0
- package/es/view/glyph.d.ts +14 -0
- package/es/view/glyph.js +27 -0
- package/es/view/glyph.js.map +1 -0
- package/es/view/grammar-base.d.ts +46 -0
- package/es/view/grammar-base.js +165 -0
- package/es/view/grammar-base.js.map +1 -0
- package/es/view/grammar-record.d.ts +39 -0
- package/es/view/grammar-record.js +170 -0
- package/es/view/grammar-record.js.map +1 -0
- package/es/view/group.d.ts +13 -0
- package/es/view/group.js +39 -0
- package/es/view/group.js.map +1 -0
- package/es/view/index.d.ts +1 -0
- package/es/view/index.js +2 -0
- package/es/view/index.js.map +1 -0
- package/es/view/mark.d.ts +112 -0
- package/es/view/mark.js +604 -0
- package/es/view/mark.js.map +1 -0
- package/es/view/scale.d.ts +26 -0
- package/es/view/scale.js +82 -0
- package/es/view/scale.js.map +1 -0
- package/es/view/signal.d.ts +18 -0
- package/es/view/signal.js +52 -0
- package/es/view/signal.js.map +1 -0
- package/package.json +67 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: !0
|
|
5
|
+
}), exports.rotateOut = exports.rotateIn = void 0;
|
|
6
|
+
|
|
7
|
+
const vutils_1 = require("@visactor/vutils"), rotateIn = (element, options, animationParameters) => {
|
|
8
|
+
var _a;
|
|
9
|
+
const finalAngle = null !== (_a = element.getGraphicAttribute("angle", !1)) && void 0 !== _a ? _a : 0;
|
|
10
|
+
let angle = 0;
|
|
11
|
+
return angle = (0, vutils_1.isNumberClose)(finalAngle / (2 * Math.PI), 0) ? Math.round(finalAngle / (2 * Math.PI)) * Math.PI * 2 : (0,
|
|
12
|
+
vutils_1.isValidNumber)(null == options ? void 0 : options.angle) ? options.angle : "anticlockwise" === (null == options ? void 0 : options.orient) ? Math.ceil(finalAngle / (2 * Math.PI)) * Math.PI * 2 : Math.floor(finalAngle / (2 * Math.PI)) * Math.PI * 2,
|
|
13
|
+
{
|
|
14
|
+
from: {
|
|
15
|
+
angle: angle
|
|
16
|
+
},
|
|
17
|
+
to: {
|
|
18
|
+
angle: finalAngle
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
exports.rotateIn = rotateIn;
|
|
24
|
+
|
|
25
|
+
const rotateOut = (element, options, animationParameters) => {
|
|
26
|
+
var _a;
|
|
27
|
+
const finalAngle = null !== (_a = element.getGraphicAttribute("angle", !0)) && void 0 !== _a ? _a : 0;
|
|
28
|
+
let angle = 0;
|
|
29
|
+
return angle = (0, vutils_1.isNumberClose)(finalAngle / (2 * Math.PI), 0) ? Math.round(finalAngle / (2 * Math.PI)) * Math.PI * 2 : (0,
|
|
30
|
+
vutils_1.isValidNumber)(null == options ? void 0 : options.angle) ? options.angle : "anticlockwise" === (null == options ? void 0 : options.orient) ? Math.ceil(finalAngle / (2 * Math.PI)) * Math.PI * 2 : Math.floor(finalAngle / (2 * Math.PI)) * Math.PI * 2,
|
|
31
|
+
{
|
|
32
|
+
from: {
|
|
33
|
+
angle: finalAngle
|
|
34
|
+
},
|
|
35
|
+
to: {
|
|
36
|
+
angle: angle
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
exports.rotateOut = rotateOut;
|
|
42
|
+
//# sourceMappingURL=rotate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/graph/animation/animation/rotate.ts"],"names":[],"mappings":";;;AAAA,6CAAgE;AAGzD,MAAM,QAAQ,GAA4B,CAC/C,OAAiB,EACjB,OAAgC,EAChC,mBAAyC,EACzC,EAAE;;IACF,MAAM,UAAU,GAAG,MAAA,OAAO,CAAC,mBAAmB,CAAC,OAAO,EAAE,KAAK,CAAC,mCAAI,CAAC,CAAC;IACpE,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,IAAI,IAAA,sBAAa,EAAC,UAAU,GAAG,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE;QAChD,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,GAAG,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC;KAC9D;SAAM,IAAI,IAAA,sBAAa,EAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,KAAK,CAAC,EAAE;QACxC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;KACvB;SAAM,IAAI,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,MAAM,MAAK,eAAe,EAAE;QAC9C,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,GAAG,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC;KAC7D;SAAM;QACL,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,GAAG,C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CAAC;KAC9D;IACD,OAAO;QACL,IAAI,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE;QAC3B,EAAE,EAAE,EAAE,KAAK,EAAE;KACd,CAAC;AACJ,CAAC,CAAC;AApBW,QAAA,SAAS,aAoBpB","file":"rotate.js","sourcesContent":["import { isNumberClose, isValidNumber } from '@visactor/vutils';\nimport type { IAnimationParameters, IRotateAnimationOptions, TypeAnimation, IElement } from '../../../types';\n\nexport const rotateIn: TypeAnimation<IElement> = (\n element: IElement,\n options: IRotateAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const finalAngle = element.getGraphicAttribute('angle', false) ?? 0;\n let angle = 0;\n if (isNumberClose(finalAngle / (Math.PI * 2), 0)) {\n angle = Math.round(finalAngle / (Math.PI * 2)) * Math.PI * 2;\n } else if (isValidNumber(options?.angle)) {\n angle = options.angle;\n } else if (options?.orient === 'anticlockwise') {\n angle = Math.ceil(finalAngle / (Math.PI * 2)) * Math.PI * 2;\n } else {\n angle = Math.floor(finalAngle / (Math.PI * 2)) * Math.PI * 2;\n }\n return {\n from: { angle },\n to: { angle: finalAngle }\n };\n};\n\nexport const rotateOut: TypeAnimation<IElement> = (\n element: IElement,\n options: IRotateAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const finalAngle = element.getGraphicAttribute('angle', true) ?? 0;\n let angle = 0;\n if (isNumberClose(finalAngle / (Math.PI * 2), 0)) {\n angle = Math.round(finalAngle / (Math.PI * 2)) * Math.PI * 2;\n } else if (isValidNumber(options?.angle)) {\n angle = options.angle;\n } else if (options?.orient === 'anticlockwise') {\n angle = Math.ceil(finalAngle / (Math.PI * 2)) * Math.PI * 2;\n } else {\n angle = Math.floor(finalAngle / (Math.PI * 2)) * Math.PI * 2;\n }\n return {\n from: { angle: finalAngle },\n to: { angle }\n };\n};\n"]}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: !0
|
|
5
|
+
}), exports.scaleOut = exports.scaleIn = void 0;
|
|
6
|
+
|
|
7
|
+
const scaleIn = (element, options, animationParameters) => {
|
|
8
|
+
var _a, _b, _c, _d;
|
|
9
|
+
switch (null == options ? void 0 : options.direction) {
|
|
10
|
+
case "x":
|
|
11
|
+
return {
|
|
12
|
+
from: {
|
|
13
|
+
scaleX: 0
|
|
14
|
+
},
|
|
15
|
+
to: {
|
|
16
|
+
scaleX: null !== (_a = element.getGraphicAttribute("scaleX", !1)) && void 0 !== _a ? _a : 1
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
case "y":
|
|
21
|
+
return {
|
|
22
|
+
from: {
|
|
23
|
+
scaleY: 0
|
|
24
|
+
},
|
|
25
|
+
to: {
|
|
26
|
+
scaleY: null !== (_b = element.getGraphicAttribute("scaleY", !1)) && void 0 !== _b ? _b : 1
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
default:
|
|
31
|
+
return {
|
|
32
|
+
from: {
|
|
33
|
+
scaleX: 0,
|
|
34
|
+
scaleY: 0
|
|
35
|
+
},
|
|
36
|
+
to: {
|
|
37
|
+
scaleX: null !== (_c = element.getGraphicAttribute("scaleX", !1)) && void 0 !== _c ? _c : 1,
|
|
38
|
+
scaleY: null !== (_d = element.getGraphicAttribute("scaleY", !1)) && void 0 !== _d ? _d : 1
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
exports.scaleIn = scaleIn;
|
|
45
|
+
|
|
46
|
+
const scaleOut = (element, options, animationParameters) => {
|
|
47
|
+
var _a, _b, _c, _d;
|
|
48
|
+
switch (null == options ? void 0 : options.direction) {
|
|
49
|
+
case "x":
|
|
50
|
+
return {
|
|
51
|
+
from: {
|
|
52
|
+
scaleX: null !== (_a = element.getGraphicAttribute("scaleX", !0)) && void 0 !== _a ? _a : 1
|
|
53
|
+
},
|
|
54
|
+
to: {
|
|
55
|
+
scaleX: 0
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
case "y":
|
|
60
|
+
return {
|
|
61
|
+
from: {
|
|
62
|
+
scaleY: null !== (_b = element.getGraphicAttribute("scaleY", !0)) && void 0 !== _b ? _b : 1
|
|
63
|
+
},
|
|
64
|
+
to: {
|
|
65
|
+
scaleY: 0
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
default:
|
|
70
|
+
return {
|
|
71
|
+
from: {
|
|
72
|
+
scaleX: null !== (_c = element.getGraphicAttribute("scaleX", !0)) && void 0 !== _c ? _c : 1,
|
|
73
|
+
scaleY: null !== (_d = element.getGraphicAttribute("scaleY", !0)) && void 0 !== _d ? _d : 1
|
|
74
|
+
},
|
|
75
|
+
to: {
|
|
76
|
+
scaleX: 0,
|
|
77
|
+
scaleY: 0
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
exports.scaleOut = scaleOut;
|
|
84
|
+
//# sourceMappingURL=scale.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/graph/animation/animation/scale.ts"],"names":[],"mappings":";;;AAIO,MAAM,OAAO,GAA4B,CAC9C,OAAiB,EACjB,OAA+B,EAC/B,mBAAyC,EACzC,EAAE;;IACF,QAAQ,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,SAAS,EAAE;QAC1B,KAAK,GAAG;YACN,OAAO;gBACL,IAAI,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE;gBACnB,EAAE,EAAE,EAAE,MAAM,EAAE,MAAA,OAAO,CAAC,mBAAmB,CAAC,QAAQ,EAAE,KAAK,CAAC,mCAAI,CAAC,EAAE;aAClE,CAAC;QACJ,KAAK,GAAG;YACN,OAAO;gBACL,IAAI,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE;gBACnB,EAAE,EAAE,EAAE,MAAM,EA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EAAE,IAAI,CAAC,mCAAI,CAAC;iBACzD;gBACD,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE;aAC7B,CAAC;KACL;AACH,CAAC,CAAC;AA1BW,QAAA,QAAQ,YA0BnB","file":"scale.js","sourcesContent":["import type { IElement, IScaleAnimationOptions, IAnimationParameters, TypeAnimation } from '../../../types';\n\n// TODO: negative direction, need support from VRender\n\nexport const scaleIn: TypeAnimation<IElement> = (\n element: IElement,\n options: IScaleAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n switch (options?.direction) {\n case 'x':\n return {\n from: { scaleX: 0 },\n to: { scaleX: element.getGraphicAttribute('scaleX', false) ?? 1 }\n };\n case 'y':\n return {\n from: { scaleY: 0 },\n to: { scaleY: element.getGraphicAttribute('scaleY', false) ?? 1 }\n };\n case 'xy':\n default:\n return {\n from: { scaleX: 0, scaleY: 0 },\n to: {\n scaleX: element.getGraphicAttribute('scaleX', false) ?? 1,\n scaleY: element.getGraphicAttribute('scaleY', false) ?? 1\n }\n };\n }\n};\n\nexport const scaleOut: TypeAnimation<IElement> = (\n element: IElement,\n options: IScaleAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n switch (options?.direction) {\n case 'x':\n return {\n from: { scaleX: element.getGraphicAttribute('scaleX', true) ?? 1 },\n to: { scaleX: 0 }\n };\n case 'y':\n return {\n from: { scaleY: element.getGraphicAttribute('scaleY', true) ?? 1 },\n to: { scaleY: 0 }\n };\n case 'xy':\n default:\n return {\n from: {\n scaleX: element.getGraphicAttribute('scaleX', true) ?? 1,\n scaleY: element.getGraphicAttribute('scaleY', true) ?? 1\n },\n to: { scaleX: 0, scaleY: 0 }\n };\n }\n};\n"]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: !0
|
|
5
|
+
}), exports.update = void 0;
|
|
6
|
+
|
|
7
|
+
const vutils_1 = require("@visactor/vutils"), vgrammar_util_1 = require("@visactor/vgrammar-util"), defaultExcludedChannels = [ "visible", "path", "text", "lineWidth", "textBaseline", "textAlign" ], update = (element, options, animationParameters) => {
|
|
8
|
+
const from = Object.assign({}, element.getPrevGraphicAttributes()), to = Object.assign({}, element.getNextGraphicAttributes());
|
|
9
|
+
return defaultExcludedChannels.forEach((key => {
|
|
10
|
+
delete from[key], delete to[key];
|
|
11
|
+
})), (0, vutils_1.array)(null == options ? void 0 : options.excludeChannels).forEach((key => {
|
|
12
|
+
delete from[key], delete to[key];
|
|
13
|
+
})), Object.keys(to).forEach((key => {
|
|
14
|
+
(0, vgrammar_util_1.isEqual)(key, from, to) && (delete from[key], delete to[key]);
|
|
15
|
+
})), {
|
|
16
|
+
from: from,
|
|
17
|
+
to: to
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
exports.update = update;
|
|
22
|
+
//# sourceMappingURL=update.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/graph/animation/animation/update.ts"],"names":[],"mappings":";;;AAAA,6CAAyC;AACzC,2DAAkD;AAKlD,MAAM,uBAAuB,GAAG;IAC9B,SAAS;IAGT,MAAM;IAGN,MAAM;IACN,WAAW;IACX,cAAc;IACd,WAAW;CACZ,CAAC;AAMK,MAAM,MAAM,GAA4B,CAC7C,OAAiB,EACjB,OAAgC,EAChC,mBAAyC,EACzC,EAAE;IACF,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,OAAO,CAAC,wBAAwB,EAAE,CAAC,CAAC;IACnE,MAAM,EAAE,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,OAAO,CAAC,wBAAwB,EAAE,CAAC,CAAC;IACjE,uBAAuB,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;QACpC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;QACjB,OAAO,EAAE,CAAC,GAAG,CAAC,CAAC;IACjB,CAAC,CAAC,CAAC;IACH,IAAA,cAAK,EAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,eAAe,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;QAC5C,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;QACjB,OAAO,EAAE,CAAC,GAAG,CAAC,CAAC;IACjB,CAAC,CAAC,CAAC;IACH,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;QAC5B,IAAI,IAAA,uBAAO,EAAC,GAAG,EAAE,IAAI,EAAE,EAAE,CAAC,EAAE;YAC1B,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;YACjB,OAAO,EAAE,CAAC,GAAG,CAAC,CAAC;SAChB;IACH,CAAC,CAAC,CAAC;IACH,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC;AACtB,CAAC,CAAC;AAtBW,QAAA,MAAM,UAsBjB","file":"update.js","sourcesContent":["import { array } from '@visactor/vutils';\nimport { isEqual } from '@visactor/vgrammar-util';\nimport type { IElement } from '../../../types';\nimport type { IAnimationParameters, TypeAnimation } from '../../../types/animate';\n\n// FIXME: channels which do not animate should be handled by VRender\nconst defaultExcludedChannels = [\n 'visible',\n\n // path channel\n 'path',\n\n // text channels\n 'text',\n 'lineWidth',\n 'textBaseline',\n 'textAlign'\n];\n\nexport interface IUpdateAnimationOptions {\n excludeChannels: string[];\n}\n\nexport const update: TypeAnimation<IElement> = (\n element: IElement,\n options: IUpdateAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const from = Object.assign({}, element.getPrevGraphicAttributes());\n const to = Object.assign({}, element.getNextGraphicAttributes());\n defaultExcludedChannels.forEach(key => {\n delete from[key];\n delete to[key];\n });\n array(options?.excludeChannels).forEach(key => {\n delete from[key];\n delete to[key];\n });\n Object.keys(to).forEach(key => {\n if (isEqual(key, from, to)) {\n delete from[key];\n delete to[key];\n }\n });\n return { from, to };\n};\n"]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { IAnimationTimeline, IAnimator, IAnimatorOptions, IAnimationUnit, IAnimationParameters, IElement } from '../../types';
|
|
2
|
+
export declare class Animator implements IAnimator {
|
|
3
|
+
id: number;
|
|
4
|
+
element: IElement;
|
|
5
|
+
animationOptions: IAnimatorOptions;
|
|
6
|
+
isAnimating: boolean;
|
|
7
|
+
private unit;
|
|
8
|
+
private runnings;
|
|
9
|
+
private callbackFunction;
|
|
10
|
+
constructor(element: IElement, unit: IAnimationUnit, animationOptions: {
|
|
11
|
+
state: string;
|
|
12
|
+
timeline: IAnimationTimeline;
|
|
13
|
+
id: string;
|
|
14
|
+
});
|
|
15
|
+
callback(callbackFunction: (...args: any[]) => void): this;
|
|
16
|
+
animate(animationParameters: IAnimationParameters, parameters: any): this;
|
|
17
|
+
stop(stopState?: 'start' | 'end', invokeCallback?: boolean): this;
|
|
18
|
+
pause(): this;
|
|
19
|
+
resume(): this;
|
|
20
|
+
startAt(startTime: number): this;
|
|
21
|
+
getTotalAnimationTime(): number;
|
|
22
|
+
getEndAttributes(): Record<string, any>;
|
|
23
|
+
private animationEnd;
|
|
24
|
+
private animateElement;
|
|
25
|
+
private animateTimeSlice;
|
|
26
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: !0
|
|
5
|
+
}), exports.Animator = void 0;
|
|
6
|
+
|
|
7
|
+
const vutils_1 = require("@visactor/vutils"), vrender_1 = require("@visactor/vrender"), attribute_1 = require("./attribute");
|
|
8
|
+
|
|
9
|
+
vrender_1.Animate.mode |= vrender_1.AnimateMode.SET_ATTR_IMMEDIATELY;
|
|
10
|
+
|
|
11
|
+
let GlobalAnimatorId = 0;
|
|
12
|
+
|
|
13
|
+
const isCustomAnimateCtor = custom => !(0, vutils_1.isNil)(custom) && custom.prototype instanceof vrender_1.ACustomAnimate;
|
|
14
|
+
|
|
15
|
+
class Animator {
|
|
16
|
+
constructor(element, unit, animationOptions) {
|
|
17
|
+
this.id = GlobalAnimatorId++, this.isAnimating = !1, this.runnings = [], this.element = element,
|
|
18
|
+
this.animationOptions = animationOptions, this.unit = unit;
|
|
19
|
+
}
|
|
20
|
+
callback(callbackFunction) {
|
|
21
|
+
return this.callbackFunction = callbackFunction, this;
|
|
22
|
+
}
|
|
23
|
+
animate(animationParameters, parameters) {
|
|
24
|
+
return this.isAnimating = !0, this.animateElement(animationParameters, parameters),
|
|
25
|
+
0 === this.runnings.length && this.animationEnd(), this;
|
|
26
|
+
}
|
|
27
|
+
stop(stopState = "end", invokeCallback = !0) {
|
|
28
|
+
return this.runnings.forEach((running => running.stop(stopState))), this.animationEnd(invokeCallback),
|
|
29
|
+
this;
|
|
30
|
+
}
|
|
31
|
+
pause() {
|
|
32
|
+
return this.runnings.forEach((running => running.pause())), this;
|
|
33
|
+
}
|
|
34
|
+
resume() {
|
|
35
|
+
return this.runnings.forEach((running => running.resume())), this;
|
|
36
|
+
}
|
|
37
|
+
startAt(startTime) {
|
|
38
|
+
return this.runnings.forEach((running => {
|
|
39
|
+
const initialDelay = this.unit.initialDelay;
|
|
40
|
+
running.startAt(initialDelay + startTime);
|
|
41
|
+
})), this;
|
|
42
|
+
}
|
|
43
|
+
getTotalAnimationTime() {
|
|
44
|
+
var _a;
|
|
45
|
+
const timeLineDuration = this.unit.initialDelay + this.unit.loopDuration * this.unit.loopCount;
|
|
46
|
+
return null !== (_a = this.unit.totalTime) && void 0 !== _a ? _a : timeLineDuration;
|
|
47
|
+
}
|
|
48
|
+
getEndAttributes() {
|
|
49
|
+
return this.runnings.reduce(((attributes, running) => Object.assign(attributes, running.getEndProps())), {});
|
|
50
|
+
}
|
|
51
|
+
animationEnd(invokeCallback = !0) {
|
|
52
|
+
var _a;
|
|
53
|
+
this.isAnimating = !1, this.runnings = null, invokeCallback && (null === (_a = this.callbackFunction) || void 0 === _a || _a.call(null));
|
|
54
|
+
}
|
|
55
|
+
animateElement(animationParameters, parameters) {
|
|
56
|
+
const graphicAnimate = this.element.getGraphicItem().animate();
|
|
57
|
+
this.runnings.push(graphicAnimate), graphicAnimate.startAt(this.unit.initialDelay),
|
|
58
|
+
graphicAnimate.wait(this.unit.loopDelay), this.unit.timeSlices.forEach((timeSlice => {
|
|
59
|
+
this.animateTimeSlice(graphicAnimate, timeSlice, animationParameters, parameters);
|
|
60
|
+
})), graphicAnimate.wait(this.unit.loopDelayAfter), graphicAnimate.loop(this.unit.loopCount - 1),
|
|
61
|
+
(0, vutils_1.isValidNumber)(this.unit.totalTime) && setTimeout((() => {
|
|
62
|
+
graphicAnimate && graphicAnimate.stop("end");
|
|
63
|
+
}), this.unit.totalTime), graphicAnimate.onEnd((() => {
|
|
64
|
+
this.runnings = this.runnings.filter((running => running !== graphicAnimate)), 0 === this.runnings.length && this.animationEnd();
|
|
65
|
+
}));
|
|
66
|
+
}
|
|
67
|
+
animateTimeSlice(graphicAnimate, timeSlice, animationParameters, parameters) {
|
|
68
|
+
const delay = timeSlice.delay, duration = timeSlice.duration, effects = timeSlice.effects;
|
|
69
|
+
if (delay > 0 && graphicAnimate.wait(delay), effects.length < 0) graphicAnimate.wait(duration); else {
|
|
70
|
+
const customAnimates = effects.map(((effect, index) => {
|
|
71
|
+
var _a;
|
|
72
|
+
const attributes = null !== (_a = effect.type ? (0, attribute_1.typeAnimationAttributes)(this.element, effect, animationParameters, parameters) : (0,
|
|
73
|
+
attribute_1.channelAnimationAttributes)(this.element, effect, animationParameters, parameters)) && void 0 !== _a ? _a : {}, customOption = (null == attributes ? void 0 : attributes.custom) || (null == effect ? void 0 : effect.custom), customParametersOption = (null == attributes ? void 0 : attributes.customParameters) || (null == effect ? void 0 : effect.customParameters);
|
|
74
|
+
attributes.from && Object.keys(attributes.from).length && this.unit && this.animationOptions.timeline.controlOptions.immediatelyApply && "component" !== this.element.mark.markType && this.element.getGraphicItem().setAttributes(attributes.from);
|
|
75
|
+
const isCustomAnimate = isCustomAnimateCtor(customOption);
|
|
76
|
+
return !(0, vutils_1.isNil)(customOption) && !isCustomAnimateCtor(customOption) ? new attribute_1.CustomInterpolator(attributes.from, attributes.to, duration, effect.easing, {
|
|
77
|
+
interpolator: customOption,
|
|
78
|
+
element: this.element,
|
|
79
|
+
parameters: customParametersOption
|
|
80
|
+
}) : isCustomAnimate ? new customOption(attributes.from, attributes.to, duration, effect.easing, customParametersOption) : attributes.to ? new attribute_1.AttributeAnimate(attributes.from, attributes.to, duration, effect.easing) : void 0;
|
|
81
|
+
})).filter((animate => !(0, vutils_1.isNil)(animate)));
|
|
82
|
+
1 === customAnimates.length ? graphicAnimate.play(customAnimates[0]) : graphicAnimate.play(new vrender_1.AnimateGroup(duration, customAnimates));
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
exports.Animator = Animator;
|
|
88
|
+
//# sourceMappingURL=animator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/graph/animation/animator.ts"],"names":[],"mappings":";;;AAAA,6CAAwD;AAGxD,+CAAuF;AAavF,2CAAwH;AAExH,iBAAO,CAAC,IAAI,IAAI,qBAAW,CAAC,oBAAoB,CAAC;AAEjD,IAAI,gBAAgB,GAAG,CAAC,CAAC;AAEzB,MAAM,mBAAmB,GAAG,CAAC,MAAoE,EAAE,EAAE;IACnG,OAAO,CAAC,IAAA,cAAK,EAAC,MAAM,CAAC,IAAI,MAAM,CAAC,SAAS,YAAY,wBAAc,CAAC;AACtE,CAAC,CAAC;AAEF,MAAa,QAAQ;IAUnB,YACE,OAAiB,EACjB,IAAoB,EACpB,gBAIC;QAhBH,OAAE,GAAW,gBAAgB,EAAE,CAAC;QAGhC,gBAAW,GAAY,KAAK,CAAC;QAGrB,aAAQ,GAAsB,EAAE,CAAC;QAYvC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,gBAAgB,GAAG,gBA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M,EAAE;wBACrF,YAAY,EAAE,YAA6C;wBAC3D,OAAO,EAAE,IAAI,CAAC,OAAO;wBACrB,UAAU,EAAE,sBAAsB;qBACnC,CAAC,CAAC;iBACJ;qBAAM,IAAI,eAAe,EAAE;oBAC1B,OAAO,IAAK,YAA4C,CACtD,UAAU,CAAC,IAAI,EACf,UAAU,CAAC,EAAE,EACb,QAAQ,EACR,MAAM,CAAC,MAAM,EACb,sBAAsB,CACvB,CAAC;iBACH;qBAAM,IAAI,UAAU,CAAC,EAAE,EAAE;oBACxB,OAAO,IAAI,4BAAgB,CAAC,UAAU,CAAC,IAAI,EAAE,UAAU,CAAC,EAAE,EAAE,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;iBACtF;YACH,CAAC,CAAC;iBACD,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,IAAA,cAAK,EAAC,OAAO,CAAC,CAAC,CAAC;YAEtC,IAAI,cAAc,CAAC,MAAM,KAAK,CAAC,EAAE;gBAC/B,cAAc,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC;aACxC;iBAAM;gBACL,cAAc,CAAC,IAAI,CAAC,IAAI,sBAAY,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAC,CAAC;aACjE;SACF;IACH,CAAC;CACF;AAvLD,4BAuLC","file":"animator.js","sourcesContent":["import { isNil, isValidNumber } from '@visactor/vutils';\nimport type { IAnimate as IGraphicAnimate } from '@visactor/vrender';\n// eslint-disable-next-line no-duplicate-imports\nimport { ACustomAnimate, Animate, AnimateGroup, AnimateMode } from '@visactor/vrender';\nimport type {\n IAnimationChannelInterpolator,\n IAnimationCustomConstructor,\n IAnimationTimeline,\n IAnimator,\n IAnimatorOptions,\n IAnimationUnit,\n IAnimationParameters,\n IAnimationTimeSlice,\n IElement,\n IAnimationEffect\n} from '../../types';\nimport { AttributeAnimate, channelAnimationAttributes, CustomInterpolator, typeAnimationAttributes } from './attribute';\n\nAnimate.mode |= AnimateMode.SET_ATTR_IMMEDIATELY;\n\nlet GlobalAnimatorId = 0;\n\nconst isCustomAnimateCtor = (custom?: IAnimationChannelInterpolator | IAnimationCustomConstructor) => {\n return !isNil(custom) && custom.prototype instanceof ACustomAnimate;\n};\n\nexport class Animator implements IAnimator {\n id: number = GlobalAnimatorId++;\n element: IElement;\n animationOptions: IAnimatorOptions;\n isAnimating: boolean = false;\n\n private unit: IAnimationUnit;\n private runnings: IGraphicAnimate[] = [];\n private callbackFunction: (...args: any[]) => any;\n\n constructor(\n element: IElement,\n unit: IAnimationUnit,\n animationOptions: {\n state: string;\n timeline: IAnimationTimeline;\n id: string;\n }\n ) {\n this.element = element;\n this.animationOptions = animationOptions;\n this.unit = unit;\n }\n\n callback(callbackFunction: (...args: any[]) => void): this {\n this.callbackFunction = callbackFunction;\n return this;\n }\n\n animate(animationParameters: IAnimationParameters, parameters: any): this {\n this.isAnimating = true;\n\n this.animateElement(animationParameters, parameters);\n\n // if no valid running, end animating immediately\n if (this.runnings.length === 0) {\n this.animationEnd();\n }\n return this;\n }\n\n stop(stopState: 'start' | 'end' = 'end', invokeCallback: boolean = true): this {\n // FIXME: wait for VRender to fix 'end' parameter\n this.runnings.forEach(running => running.stop(stopState));\n this.animationEnd(invokeCallback);\n return this;\n }\n\n pause(): this {\n this.runnings.forEach(running => running.pause());\n return this;\n }\n\n resume(): this {\n this.runnings.forEach(running => running.resume());\n return this;\n }\n\n startAt(startTime: number): this {\n this.runnings.forEach(running => {\n const initialDelay = this.unit.initialDelay;\n running.startAt(initialDelay + startTime);\n });\n return this;\n }\n\n getTotalAnimationTime() {\n const timeLineDuration = this.unit.initialDelay + this.unit.loopDuration * this.unit.loopCount;\n return this.unit.totalTime ?? timeLineDuration;\n }\n\n getEndAttributes() {\n return this.runnings.reduce((attributes, running) => {\n return Object.assign(attributes, running.getEndProps());\n }, {} as Record<string, any>);\n }\n\n private animationEnd(invokeCallback: boolean = true) {\n this.isAnimating = false;\n this.runnings = null;\n if (invokeCallback) {\n this.callbackFunction?.call(null);\n }\n }\n\n private animateElement(animationParameters: IAnimationParameters, parameters: any) {\n const graphicAnimate: IGraphicAnimate = this.element.getGraphicItem().animate();\n this.runnings.push(graphicAnimate);\n // initialDelay is only used at first loop\n graphicAnimate.startAt(this.unit.initialDelay);\n // execute loop animation\n graphicAnimate.wait(this.unit.loopDelay);\n this.unit.timeSlices.forEach(timeSlice => {\n this.animateTimeSlice(graphicAnimate, timeSlice, animationParameters, parameters);\n });\n graphicAnimate.wait(this.unit.loopDelayAfter);\n\n graphicAnimate.loop(this.unit.loopCount - 1);\n\n if (isValidNumber(this.unit.totalTime)) {\n // FIXME: use VRender api instead after VRender refactor is finished\n setTimeout(() => {\n if (graphicAnimate) {\n graphicAnimate.stop('end');\n }\n }, this.unit.totalTime);\n }\n\n graphicAnimate.onEnd(() => {\n this.runnings = this.runnings.filter(running => running !== graphicAnimate);\n if (this.runnings.length === 0) {\n this.animationEnd();\n }\n });\n }\n\n private animateTimeSlice(\n graphicAnimate: IGraphicAnimate,\n timeSlice: IAnimationTimeSlice,\n animationParameters: IAnimationParameters,\n parameters: any\n ) {\n const delay = timeSlice.delay as number;\n const duration = timeSlice.duration as number;\n const effects = timeSlice.effects as IAnimationEffect[];\n\n // wait in loop animation before animation starts\n if (delay > 0) {\n graphicAnimate.wait(delay);\n }\n\n if (effects.length < 0) {\n graphicAnimate.wait(duration);\n } else {\n const customAnimates = effects\n .map((effect, index) => {\n const attributes =\n (effect.type\n ? typeAnimationAttributes(this.element, effect, animationParameters, parameters)\n : channelAnimationAttributes(this.element, effect, animationParameters, parameters)) ?? {};\n const customOption = attributes?.custom || effect?.custom;\n const customParametersOption = attributes?.customParameters || effect?.customParameters;\n\n if (\n attributes.from &&\n Object.keys(attributes.from).length &&\n this.unit &&\n this.animationOptions.timeline.controlOptions.immediatelyApply &&\n this.element.mark.markType !== 'component'\n ) {\n this.element.getGraphicItem().setAttributes(attributes.from);\n }\n\n const isCustomAnimate = isCustomAnimateCtor(customOption);\n const isCustomInterpolator = !isNil(customOption) && !isCustomAnimateCtor(customOption);\n\n if (isCustomInterpolator) {\n return new CustomInterpolator(attributes.from, attributes.to, duration, effect.easing, {\n interpolator: customOption as IAnimationChannelInterpolator,\n element: this.element,\n parameters: customParametersOption\n });\n } else if (isCustomAnimate) {\n return new (customOption as IAnimationCustomConstructor)(\n attributes.from,\n attributes.to,\n duration,\n effect.easing,\n customParametersOption\n );\n } else if (attributes.to) {\n return new AttributeAnimate(attributes.from, attributes.to, duration, effect.easing);\n }\n })\n .filter(animate => !isNil(animate));\n\n if (customAnimates.length === 1) {\n graphicAnimate.play(customAnimates[0]);\n } else {\n graphicAnimate.play(new AnimateGroup(duration, customAnimates));\n }\n }\n }\n}\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { IAnimateArranger, IAnimator } from '../../types/animate';
|
|
2
|
+
export declare class Arranger implements IAnimateArranger {
|
|
3
|
+
afterArranger: IAnimateArranger;
|
|
4
|
+
parallelArrangers: IAnimateArranger[];
|
|
5
|
+
animators: IAnimator[];
|
|
6
|
+
totalTime: number;
|
|
7
|
+
startTime: number;
|
|
8
|
+
endTime: number;
|
|
9
|
+
constructor(animators: IAnimator[]);
|
|
10
|
+
parallel(arranger: IAnimateArranger): this;
|
|
11
|
+
after(arranger: IAnimateArranger): this;
|
|
12
|
+
arrangeTime(): void;
|
|
13
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: !0
|
|
5
|
+
}), exports.Arranger = void 0;
|
|
6
|
+
|
|
7
|
+
const vutils_1 = require("@visactor/vutils");
|
|
8
|
+
|
|
9
|
+
class Arranger {
|
|
10
|
+
constructor(animators) {
|
|
11
|
+
this.parallelArrangers = [ this ], this.totalTime = 0, this.startTime = 0, this.endTime = 0,
|
|
12
|
+
this.animators = animators.filter((animator => !(0, vutils_1.isNil)(animator))),
|
|
13
|
+
this.totalTime = this.animators.reduce(((time, animator) => Math.max(time, animator.getTotalAnimationTime())), 0);
|
|
14
|
+
}
|
|
15
|
+
parallel(arranger) {
|
|
16
|
+
const parallelArrangers = Array.from(new Set(this.parallelArrangers.concat(arranger.parallelArrangers)));
|
|
17
|
+
return parallelArrangers.forEach((arranger => {
|
|
18
|
+
arranger.parallelArrangers = parallelArrangers;
|
|
19
|
+
})), this.arrangeTime(), this;
|
|
20
|
+
}
|
|
21
|
+
after(arranger) {
|
|
22
|
+
return this.afterArranger = arranger, this.arrangeTime(), this;
|
|
23
|
+
}
|
|
24
|
+
arrangeTime() {
|
|
25
|
+
const parallelTime = this.parallelArrangers.reduce(((time, arranger) => Math.max(time, arranger.totalTime)), this.totalTime), startTime = this.parallelArrangers.reduce(((time, arranger) => {
|
|
26
|
+
var _a, _b;
|
|
27
|
+
return Math.max(time, null !== (_b = null === (_a = arranger.afterArranger) || void 0 === _a ? void 0 : _a.endTime) && void 0 !== _b ? _b : 0);
|
|
28
|
+
}), 0);
|
|
29
|
+
this.parallelArrangers.forEach((arranger => {
|
|
30
|
+
arranger.startTime = startTime, arranger.endTime = startTime + parallelTime, arranger.animators.forEach((animator => {
|
|
31
|
+
animator.startAt(startTime);
|
|
32
|
+
}));
|
|
33
|
+
}));
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
exports.Arranger = Arranger;
|
|
38
|
+
//# sourceMappingURL=arranger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/graph/animation/arranger.ts"],"names":[],"mappings":";;;AAAA,6CAAyC;AAGzC,MAAa,QAAQ;IASnB,YAAY,SAAsB;QAPlC,sBAAiB,GAAuB,CAAC,IAAI,CAAC,CAAC;QAG/C,cAAS,GAAW,CAAC,CAAC;QACtB,cAAS,GAAW,CAAC,CAAC;QACtB,YAAO,GAAW,CAAC,CAAC;QAGlB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC,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MAAA,QAAQ,CAAC,aAAa,0CAAE,OAAO,mCAAI,CAAC,CAAC,CAAC;QAC9D,CAAC,EAAE,CAAC,CAAC,CAAC;QAEN,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;YACxC,QAAQ,CAAC,SAAS,GAAG,SAAS,CAAC;YAC/B,QAAQ,CAAC,OAAO,GAAG,SAAS,GAAG,YAAY,CAAC;YAC5C,QAAQ,CAAC,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;gBACpC,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;YAC9B,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AA/CD,4BA+CC","file":"arranger.js","sourcesContent":["import { isNil } from '@visactor/vutils';\nimport type { IAnimateArranger, IAnimator } from '../../types/animate';\n\nexport class Arranger implements IAnimateArranger {\n afterArranger: IAnimateArranger;\n parallelArrangers: IAnimateArranger[] = [this];\n\n animators: IAnimator[];\n totalTime: number = 0;\n startTime: number = 0;\n endTime: number = 0;\n\n constructor(animators: IAnimator[]) {\n this.animators = animators.filter(animator => !isNil(animator));\n this.totalTime = this.animators.reduce((time, animator) => {\n return Math.max(time, animator.getTotalAnimationTime());\n }, 0);\n }\n\n parallel(arranger: IAnimateArranger) {\n const parallelArrangers = Array.from(new Set(this.parallelArrangers.concat(arranger.parallelArrangers)));\n parallelArrangers.forEach(arranger => {\n arranger.parallelArrangers = parallelArrangers;\n });\n this.arrangeTime();\n return this;\n }\n\n after(arranger: IAnimateArranger) {\n this.afterArranger = arranger;\n this.arrangeTime();\n return this;\n }\n\n arrangeTime() {\n const parallelTime = this.parallelArrangers.reduce((time, arranger) => {\n return Math.max(time, arranger.totalTime);\n }, this.totalTime);\n const startTime = this.parallelArrangers.reduce((time, arranger) => {\n return Math.max(time, arranger.afterArranger?.endTime ?? 0);\n }, 0);\n\n this.parallelArrangers.forEach(arranger => {\n arranger.startTime = startTime;\n arranger.endTime = startTime + parallelTime;\n arranger.animators.forEach(animator => {\n animator.startAt(startTime);\n });\n });\n }\n}\n"]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { EasingType, IGraphic } from '@visactor/vrender';
|
|
2
|
+
import { ACustomAnimate } from '@visactor/vrender';
|
|
3
|
+
import type { IAnimationChannelInterpolator, IAnimationEffect, IAnimationParameters, IElement, IParsedAnimationAttrs } from '../../types';
|
|
4
|
+
export declare function typeAnimationAttributes(element: IElement, effect: IAnimationEffect, animationParameters: IAnimationParameters, parameters: any): IParsedAnimationAttrs;
|
|
5
|
+
export declare function channelAnimationAttributes(element: IElement, effect: IAnimationEffect, animationParameters: IAnimationParameters, parameters: any): IParsedAnimationAttrs;
|
|
6
|
+
export declare class CustomInterpolator extends ACustomAnimate<any> {
|
|
7
|
+
private _element;
|
|
8
|
+
private _interpolator?;
|
|
9
|
+
constructor(from: any, to: any, duration: number, easing: EasingType, params: {
|
|
10
|
+
interpolator: IAnimationChannelInterpolator;
|
|
11
|
+
element: IElement;
|
|
12
|
+
parameters?: any;
|
|
13
|
+
});
|
|
14
|
+
onBind(): void;
|
|
15
|
+
getEndProps(): void | Record<string, any>;
|
|
16
|
+
onUpdate(end: boolean, ratio: number, out: Record<string, any>): void;
|
|
17
|
+
}
|
|
18
|
+
export declare class AttributeAnimate extends ACustomAnimate<any> {
|
|
19
|
+
target: IGraphic;
|
|
20
|
+
private _fromAttribute;
|
|
21
|
+
private _toAttribute;
|
|
22
|
+
getEndProps(): Record<string, any>;
|
|
23
|
+
onBind(): void;
|
|
24
|
+
onStart(): void;
|
|
25
|
+
onEnd(): void;
|
|
26
|
+
onUpdate(end: boolean, ratio: number, out: Record<string, any>): void;
|
|
27
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: !0
|
|
5
|
+
}), exports.AttributeAnimate = exports.CustomInterpolator = exports.channelAnimationAttributes = exports.typeAnimationAttributes = void 0;
|
|
6
|
+
|
|
7
|
+
const vrender_1 = require("@visactor/vrender"), vutils_1 = require("@visactor/vutils"), helpers_1 = require("../attributes/helpers"), factory_1 = require("../../core/factory"), transformAnimationAttributes = (attributes, element) => {
|
|
8
|
+
if (!attributes) return null;
|
|
9
|
+
if (null == attributes ? void 0 : attributes.from) {
|
|
10
|
+
const from = attributes.from;
|
|
11
|
+
Object.keys(from).forEach((channel => {
|
|
12
|
+
(0, vutils_1.isNil)(from[channel]) && delete from[channel];
|
|
13
|
+
}));
|
|
14
|
+
const computePoints = (0, helpers_1.isValidPointsChannel)(Object.keys(from), element.mark.markType) && !(0,
|
|
15
|
+
vutils_1.isValid)(from.segments);
|
|
16
|
+
if (computePoints) {
|
|
17
|
+
const items = element.items.map((item => Object.assign({}, item, {
|
|
18
|
+
nextAttrs: from
|
|
19
|
+
})));
|
|
20
|
+
attributes.from = element.transformElementItems(items, element.mark.markType, computePoints);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
if (null == attributes ? void 0 : attributes.to) {
|
|
24
|
+
const to = attributes.to;
|
|
25
|
+
Object.keys(to).forEach((channel => {
|
|
26
|
+
(0, vutils_1.isNil)(to[channel]) && delete to[channel];
|
|
27
|
+
}));
|
|
28
|
+
const computePoints = (0, helpers_1.isValidPointsChannel)(Object.keys(to), element.mark.markType) && !(0,
|
|
29
|
+
vutils_1.isValid)(to.segments);
|
|
30
|
+
if (computePoints) {
|
|
31
|
+
const items = element.items.map((item => Object.assign({}, item, {
|
|
32
|
+
nextAttrs: to
|
|
33
|
+
})));
|
|
34
|
+
attributes.to = element.transformElementItems(items, element.mark.markType, computePoints);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return attributes;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
function typeAnimationAttributes(element, effect, animationParameters, parameters) {
|
|
41
|
+
const options = (0, vutils_1.isFunction)(effect.options) ? effect.options.call(null, element.getDatum(), element, parameters) : effect.options;
|
|
42
|
+
if (!effect.type || !factory_1.Factory.getAnimationType(effect.type)) return null;
|
|
43
|
+
const attributes = factory_1.Factory.getAnimationType(effect.type)(element, options, animationParameters);
|
|
44
|
+
return transformAnimationAttributes(attributes, element);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
exports.typeAnimationAttributes = typeAnimationAttributes;
|
|
48
|
+
|
|
49
|
+
const parseChannelValue = (element, channel, channelValue, animationParameters, parameters) => (0,
|
|
50
|
+
vutils_1.isFunction)(channelValue) ? channelValue(element.getDatum(), element, parameters) : channelValue;
|
|
51
|
+
|
|
52
|
+
function channelAnimationAttributes(element, effect, animationParameters, parameters) {
|
|
53
|
+
const channel = effect.channel;
|
|
54
|
+
let attributes = null;
|
|
55
|
+
return (0, vutils_1.isArray)(channel) ? attributes = channel.reduce(((res, key) => (res.from[key] = element.getGraphicAttribute(key, !0),
|
|
56
|
+
res.to[key] = element.getGraphicAttribute(key, !1), res)), {
|
|
57
|
+
from: {},
|
|
58
|
+
to: {}
|
|
59
|
+
}) : (0, vutils_1.isObject)(channel) && (attributes = Object.keys(channel).reduce(((res, key) => {
|
|
60
|
+
var _a, _b;
|
|
61
|
+
const hasFrom = !(0, vutils_1.isNil)(null === (_a = channel[key]) || void 0 === _a ? void 0 : _a.from), hasTo = !(0,
|
|
62
|
+
vutils_1.isNil)(null === (_b = channel[key]) || void 0 === _b ? void 0 : _b.to);
|
|
63
|
+
return (hasFrom || hasTo) && (res.from[key] = hasFrom ? parseChannelValue(element, 0, channel[key].from, 0, parameters) : void 0,
|
|
64
|
+
res.to[key] = hasTo ? parseChannelValue(element, 0, channel[key].to, 0, parameters) : element.getGraphicAttribute(key, !1)),
|
|
65
|
+
res;
|
|
66
|
+
}), {
|
|
67
|
+
from: {},
|
|
68
|
+
to: {}
|
|
69
|
+
})), transformAnimationAttributes(attributes, element);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
exports.channelAnimationAttributes = channelAnimationAttributes;
|
|
73
|
+
|
|
74
|
+
class CustomInterpolator extends vrender_1.ACustomAnimate {
|
|
75
|
+
constructor(from, to, duration, easing, params) {
|
|
76
|
+
super(from, to, duration, easing, params), this._interpolator = null == params ? void 0 : params.interpolator,
|
|
77
|
+
this._element = null == params ? void 0 : params.element;
|
|
78
|
+
}
|
|
79
|
+
onBind() {
|
|
80
|
+
var _a, _b;
|
|
81
|
+
this.from = null !== (_a = this.from) && void 0 !== _a ? _a : {}, this.to = null !== (_b = this.to) && void 0 !== _b ? _b : {};
|
|
82
|
+
}
|
|
83
|
+
getEndProps() {
|
|
84
|
+
return this.to;
|
|
85
|
+
}
|
|
86
|
+
onUpdate(end, ratio, out) {
|
|
87
|
+
this._interpolator && this._element && this._interpolator.call(this, ratio, this.from, this.to, out, this._element.getDatum(), this._element, this.params.parameters);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
exports.CustomInterpolator = CustomInterpolator;
|
|
92
|
+
|
|
93
|
+
class AttributeAnimate extends vrender_1.ACustomAnimate {
|
|
94
|
+
getEndProps() {
|
|
95
|
+
return this.to;
|
|
96
|
+
}
|
|
97
|
+
onBind() {
|
|
98
|
+
var _a, _b;
|
|
99
|
+
this.from = null !== (_a = this.from) && void 0 !== _a ? _a : {}, this.to = null !== (_b = this.to) && void 0 !== _b ? _b : {};
|
|
100
|
+
}
|
|
101
|
+
onStart() {
|
|
102
|
+
const from = Object.assign({}, this.from), to = Object.assign({}, this.to);
|
|
103
|
+
Object.keys(to).forEach((k => {
|
|
104
|
+
(0, vutils_1.isNil)(from[k]) && (from[k] = this.target.getComputedAttribute(k));
|
|
105
|
+
})), this.target.setAttributes(from, !1, {
|
|
106
|
+
type: vrender_1.AttributeUpdateType.ANIMATE_UPDATE,
|
|
107
|
+
animationState: {
|
|
108
|
+
ratio: 0,
|
|
109
|
+
end: !1
|
|
110
|
+
}
|
|
111
|
+
}), this._fromAttribute = from, this._toAttribute = to;
|
|
112
|
+
}
|
|
113
|
+
onEnd() {
|
|
114
|
+
this.target.setAttributes(this._toAttribute, !1, {
|
|
115
|
+
type: vrender_1.AttributeUpdateType.ANIMATE_END
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
onUpdate(end, ratio, out) {
|
|
119
|
+
this.target.stepInterpolate(this.subAnimate, this.subAnimate.animate, out, this.step, ratio, end, this._toAttribute, this._fromAttribute);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
exports.AttributeAnimate = AttributeAnimate;
|
|
124
|
+
//# sourceMappingURL=attribute.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/graph/animation/attribute.ts"],"names":[],"mappings":";;;AAEA,+CAAwE;AACxE,6CAAiF;AASjF,mDAA6D;AAC7D,gDAA6C;AAE7C,MAAM,4BAA4B,GAAG,CAAC,UAAiC,EAAE,OAAiB,EAAyB,EAAE;IACnH,IAAI,CAAC,UAAU,EAAE;QACf,OAAO,IAAI,CAAC;KACb;IAED,IAAI,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,IAAI,EAAE;QACpB,MAAM,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC;QAC7B,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;YAClC,IAAI,IAAA,cAAK,EAAC,IAAI,CAAC,OAAO,CAAC,CAAC,EAAE;gBACxB,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC;aACtB;QACH,CAAC,CAAC,CAAC;QACH,MAAM,aAAa,GAAG,IAAA,8BAAoB,EAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAA,gBAAO,EAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAChH,IAAI,aAAa,EAAE;YACjB,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CA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AI,CAAC,cAAc,CACpB,CAAC;IACJ,CAAC;CACF;AArDD,4CAqDC","file":"attribute.js","sourcesContent":["import type { EasingType, IGraphic } from '@visactor/vrender';\n// eslint-disable-next-line no-duplicate-imports\nimport { ACustomAnimate, AttributeUpdateType } from '@visactor/vrender';\nimport { isArray, isFunction, isNil, isObject, isValid } from '@visactor/vutils';\nimport type {\n IAnimationChannelInterpolator,\n IAnimationEffect,\n IAnimationParameters,\n IElement,\n IGlyphElement,\n IParsedAnimationAttrs\n} from '../../types';\nimport { isValidPointsChannel } from '../attributes/helpers';\nimport { Factory } from '../../core/factory';\n\nconst transformAnimationAttributes = (attributes: IParsedAnimationAttrs, element: IElement): IParsedAnimationAttrs => {\n if (!attributes) {\n return null;\n }\n\n if (attributes?.from) {\n const from = attributes.from;\n Object.keys(from).forEach(channel => {\n if (isNil(from[channel])) {\n delete from[channel];\n }\n });\n const computePoints = isValidPointsChannel(Object.keys(from), element.mark.markType) && !isValid(from.segments);\n if (computePoints) {\n const items = element.items.map(item => Object.assign({}, item, { nextAttrs: from }));\n attributes.from = element.transformElementItems(items, element.mark.markType, computePoints);\n }\n }\n if (attributes?.to) {\n const to = attributes.to;\n Object.keys(to).forEach(channel => {\n if (isNil(to[channel])) {\n delete to[channel];\n }\n });\n const computePoints = isValidPointsChannel(Object.keys(to), element.mark.markType) && !isValid(to.segments);\n if (computePoints) {\n const items = element.items.map(item => Object.assign({}, item, { nextAttrs: to }));\n attributes.to = element.transformElementItems(items, element.mark.markType, computePoints);\n }\n }\n\n return attributes;\n};\n\nexport function typeAnimationAttributes(\n element: IElement,\n effect: IAnimationEffect,\n animationParameters: IAnimationParameters,\n parameters: any\n): IParsedAnimationAttrs {\n // const parameters =\n const options = isFunction(effect.options)\n ? effect.options.call(null, element.getDatum(), element, parameters)\n : effect.options;\n if (!effect.type || !Factory.getAnimationType(effect.type)) {\n return null;\n }\n const attributes = Factory.getAnimationType(effect.type)(element as IGlyphElement, options, animationParameters);\n return transformAnimationAttributes(attributes, element);\n}\n\nconst parseChannelValue = (\n element: IElement,\n channel: string,\n channelValue: any,\n animationParameters: IAnimationParameters,\n parameters: any\n) => {\n return isFunction(channelValue) ? channelValue(element.getDatum(), element, parameters) : channelValue;\n};\n\nexport function channelAnimationAttributes(\n element: IElement,\n effect: IAnimationEffect,\n animationParameters: IAnimationParameters,\n parameters: any\n): IParsedAnimationAttrs {\n const channel = effect.channel;\n let attributes: IParsedAnimationAttrs = null;\n\n if (isArray(channel)) {\n attributes = channel.reduce(\n (res, key) => {\n res.from[key] = element.getGraphicAttribute(key, true);\n res.to[key] = element.getGraphicAttribute(key, false);\n return res;\n },\n { from: {}, to: {} }\n );\n } else if (isObject(channel)) {\n attributes = Object.keys(channel).reduce(\n (res, key) => {\n const hasFrom = !isNil(channel[key]?.from);\n const hasTo = !isNil(channel[key]?.to);\n\n if (hasFrom || hasTo) {\n res.from[key] = hasFrom\n ? parseChannelValue(element, key, channel[key].from, animationParameters, parameters)\n : undefined;\n res.to[key] = hasTo\n ? parseChannelValue(element, key, channel[key].to, animationParameters, parameters)\n : element.getGraphicAttribute(key, false);\n }\n\n return res;\n },\n { from: {}, to: {} }\n );\n }\n\n return transformAnimationAttributes(attributes, element);\n}\n\nexport class CustomInterpolator extends ACustomAnimate<any> {\n private _element: IElement;\n private _interpolator?: IAnimationChannelInterpolator;\n\n constructor(\n from: any,\n to: any,\n duration: number,\n easing: EasingType,\n params: { interpolator: IAnimationChannelInterpolator; element: IElement; parameters?: any }\n ) {\n super(from, to, duration, easing, params);\n this._interpolator = params?.interpolator;\n this._element = params?.element;\n }\n\n onBind() {\n this.from = this.from ?? {};\n this.to = this.to ?? {};\n }\n\n getEndProps(): void | Record<string, any> {\n return this.to;\n }\n\n onUpdate(end: boolean, ratio: number, out: Record<string, any>): void {\n if (!this._interpolator || !this._element) {\n return;\n }\n this._interpolator.call(\n this,\n ratio,\n this.from,\n this.to,\n out,\n this._element.getDatum(),\n this._element,\n this.params.parameters\n );\n }\n}\n\nexport class AttributeAnimate extends ACustomAnimate<any> {\n declare target: IGraphic;\n\n private _fromAttribute: any;\n private _toAttribute: any;\n\n getEndProps(): Record<string, any> {\n return this.to;\n }\n\n onBind() {\n this.from = this.from ?? {};\n this.to = this.to ?? {};\n }\n\n onStart(): void {\n const from = Object.assign({}, this.from);\n const to = Object.assign({}, this.to);\n Object.keys(to).forEach(k => {\n if (isNil(from[k])) {\n from[k] = this.target.getComputedAttribute(k);\n }\n // if (this.to[k] === from[k]) {\n // delete from[k];\n // }\n });\n this.target.setAttributes(from, false, {\n type: AttributeUpdateType.ANIMATE_UPDATE,\n animationState: { ratio: 0, end: false }\n });\n\n this._fromAttribute = from;\n this._toAttribute = to;\n }\n\n onEnd(): void {\n this.target.setAttributes(this._toAttribute, false, {\n type: AttributeUpdateType.ANIMATE_END\n });\n }\n\n onUpdate(end: boolean, ratio: number, out: Record<string, any>): void {\n this.target.stepInterpolate(\n this.subAnimate,\n this.subAnimate.animate,\n out,\n this.step,\n ratio,\n end,\n this._toAttribute,\n this._fromAttribute\n );\n }\n}\n"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { IElement } from '../../types';
|
|
2
|
+
import type { IAnimationConfig, IParsedAnimationConfig, MarkFunctionValueType } from '../../types/animate';
|
|
3
|
+
export declare function normalizeAnimationConfig(config: Record<string, IAnimationConfig | IAnimationConfig[]>): Array<IParsedAnimationConfig>;
|
|
4
|
+
export declare function normalizeStateAnimationConfig(state: string, config: IAnimationConfig | IAnimationConfig[], initialIndex?: number): Array<IParsedAnimationConfig>;
|
|
5
|
+
export declare function invokeAnimateSpec<T>(spec: MarkFunctionValueType<T>, element: IElement, parameters: any): T;
|