正常连接的echarts线条是没有动画效果的。需要增加在原有series数组中增加一个对象。
{
name: 'text',
type: 'lines',
coordinateSystem: 'cartesian2d', // 笛卡尔坐标系
edgeSymbol: ['circle', 'arrow'],
// polyline: true,
effect: {
show: true,
trailLength: 0,
symbol: 'arrow', // 箭头样式
color: '#000000',
symbolSize: [5, 5], // 宽度高度
period: 3 // 一次运动的秒数
},
lineStyle: {
curveness: 0 // 弯曲程度
},
data: [{coords:[[1,1],[100,100]]}]
}
注意其中data的数据结构样式,其中[1,1]为起点坐标,[100,100]为结束坐标,同时利用polyline可以设置多个运动节点。详情见echarts官网。效果如下: