logo

Ant Design Charts

  • Manual
  • Options
  • Examples
  • Productsantv logo arrow
  • 2.0.0
  • Component Overview
  • Common Configuration Statistical Charts
    • Chart composition
    • Component
      • 标题(Title)
      • Axis
      • Legend
      • Scrollbar
      • Slider
      • Tooltip
      • Label
    • Core
      • Color En
      • View
      • Data
        • overview
        • custom
        • ema
        • fetch
        • filter
        • fold
        • inline
        • join
        • kde
        • log
        • map
        • pick
        • rename
        • slice
        • sort
        • sortBy
      • Scale
        • overview
        • band
        • linear
        • log
        • ordinal
        • point
        • pow
        • quantile
        • quantize
        • sqrt
        • threshold
        • time
      • Transform
        • overview
        • bin
        • binX
        • diffY
        • dodgeX
        • flexX
        • group
        • groupColor
        • groupX
        • groupY
        • jitter
        • jitterX
        • jitterY
        • normalizeY
        • pack
        • sample
        • select
        • selectX
        • selectX
        • sortColor
        • sortX
        • sortY
        • stackEnter
        • stackY
        • symmetryY
      • Coordinate
        • overview
        • fisheye
        • parallel
        • polar
        • radial
        • theta
        • transpose
        • cartesian3D
      • 样式(Style)
      • Animate
        • overview
        • fadeIn
        • fadeOut
        • growInX
        • growInY
        • morphing
        • pathIn
        • scaleInX
        • scaleInY
        • scaleOutX
        • scaleOutY
        • waveIn
        • zoomIn
        • zoomOut
      • 状态(State)
      • Interaction
        • Overview
        • brushAxisHighlight
        • brushHighlight
        • brushXHighlight
        • brushYHighlight
        • brushFilter
        • brushXFilter
        • brushYFilter
        • chartIndex
        • elementHighlight
        • elementHighlightByColor
        • elementHighlightByX
        • elementSelect
        • elementSelectByColor
        • elementSelectByX
        • fisheye
        • legendFilter
        • legendHighlight
        • poptip
        • scrollbarFilter
        • sliderFilter
      • Composition
        • overview
        • facetCircle
        • facetRect
        • repeatMatrix
        • spaceFlex
        • spaceLayer
        • timingKeyframe
      • Theme
        • overview
        • Academy
        • classic
        • classicDark
      • event
    • Specal Plot
      • Area
      • Bar
      • CirclePacking
      • DualAxes
      • Gauge
      • Line
      • Rose
      • Sankey
      • Scatter
      • Sunburst
      • Treemap
      • Venn
      • WordCloud
      • Column
      • Pie
      • BidirectionalBar
      • Box
      • Bullet
      • Funnel
      • Heatmap
      • Histogram
      • Liquid
      • Radar
      • Stock
      • Tiny
      • Violin
      • Waterfall
      • RadialBar
  • Relation Graph Components
    • Overview
    • MindMap
    • Fishbone
    • IndentedTree
    • Dendrogram
    • OrganizationChart
    • FlowGraph
    • FlowDirectionGraph
    • NetworkGraph
    • FAQ

Overview

Next
Component Overview

Resources

Ant Design
Galacea Effects
Umi-React Application Framework
Dumi-Component doc generator
ahooks-React Hooks Library

Community

Ant Financial Experience Tech
seeconfSEE Conf-Experience Tech Conference

Help

GitHub
StackOverflow

more productsMore Productions

Ant DesignAnt Design-Enterprise UI design language
yuqueYuque-Knowledge creation and Sharing tool
EggEgg-Enterprise-class Node development framework
kitchenKitchen-Sketch Tool set
GalaceanGalacean-互动图形解决方案
xtechLiven Experience technology
© Copyright 2025 Ant Group Co., Ltd..备案号:京ICP备15032932号-38

Loading...

动画的过程本质是视觉属性在时间上的变化,带来视觉上的动画效果。在 G2 中,提供了三种动画场景类型:

  • enter - 元素第一次出现的出场动画;
  • update - 数据更新的时候,元素更新的动画;
  • exit - 数据更新的时候,元素被销毁退出画布的动画;

利用这 3 种动画场景,结合 G2 动画语法使用数据驱动动画的方式,可以配制出各种各样需要的动画效果。

开始使用

const config = {
animate: { enter: { type: 'growInX' } }
}

选项

关于 animate API 的参数,有以下,主要 3 种动画场景(enter、update、exit)和 动画 5 个属性(type、duration、delay、easing、fill)的组合。

属性描述类型默认值
enterType动画类型Type
enterDuration动画持续时间 (ms)number
enterDelay延迟执行时间 (ms)number
enterEasing动画的缓动函数Easing
enterFill动画处于非运行状态时的展示效果Fill
updateType动画类型Type
updateDuration动画持续时间 (ms)number
updateDelay延迟执行时间 (ms)number
updateEasing动画的缓动函数Easing
updateFill动画处于非运行状态时的展示效果Fill
exitType动画类型Type
exitDuration动画持续时间 (ms)number
exitDelay延迟执行时间 (ms)number
exitEasing动画的缓动函数Easing
exitFill动画处于非运行状态时的展示效果Fill

动画类型 Type

动画类型 Type 本质是设置动画的方式,会影响的视觉属性。这里具体可以看对应的文档 Animation。当然也可以设置为 null,undefined,false,代表关闭动画。

缓动函数 Easing

缓动函数指定的是动画过程中,视觉属性变化的插值函数。支持以下内置缓动函数,来自 easings,也可以上这个网站预览动画缓动的效果。

constantacceleratedecelerateaccelerate-deceleratedecelerate-accelerate
linearease-in / inease-out / outease-in-out / in-outease-out-in / out-in
easein-sineout-sinein-out-sineout-in-sine
stepsin-quadout-quadin-out-quadout-in-quad
step-startin-cubicout-cubicin-out-cubicout-in-cubic
step-endin-quartout-quartin-out-quartout-in-quart
in-quintout-quintin-out-quintout-in-quint
in-expoout-expoin-out-expoout-in-expo
in-circout-circin-out-circout-in-circ
in-backout-backin-out-backout-in-back
in-bounceout-bouncein-out-bounceout-in-bounce
in-elasticout-elasticin-out-elasticout-in-elastic
spring / spring-inspring-outspring-in-outspring-out-in

除此之外,还可以通过 cubic-bezier(<number>, <number>, <number>, <number>) 自定义形如三次贝塞尔曲线的函数。以上部分内置函数也是通过它定义完成的,例如 ease-in-sine = cubic-bezier(0.47, 0, 0.745, 0.715)。

动画填充 Fill

该属性规定了图形在动画处于非运行状态(例如动画开始前,结束后)时的展示效果,可以参考 WebAPI 规范。支持以下值:

  • auto/none - 默认值,这意味着动画在第一帧开始前和最后一帧结束后都不会影响到图形的展示效果。例如在动画完成后图形会恢复到动画前状态,如果设置了 delay 在延迟期间也不会应用第一帧的效果。
  • forwards - 动画完成后停住,不恢复到初始状态
  • backwards - 动画开始前应用第一帧效果
  • both - 为 forwards 和 backwards 的组合效果