ECharts graphic text 添加文字展示及动画
ECharts About 1,168 wordsgraphic.elements.text
使用keyframeAnimation显示文字的动画效果。
style中必须有fill属性,否则动画不生效。
loop表示循环显示动画。
option = {
graphic: {
elements: [
{
type: 'text',
left: 'center',
top: 'center',
style: {
text: 'Apache ECharts',
fontSize: 80,
fontWeight: 'bold',
lineDash: [0, 200],
lineDashOffset: 0,
fill: 'transparent',
stroke: '#000',
lineWidth: 1
},
keyframeAnimation: {
duration: 3000,
loop: true,
keyframes: [
{
percent: 0.7,
style: {
fill: 'transparent',
lineDashOffset: 200,
lineDash: [200, 0]
}
},
{
// Stop for a while.
percent: 0.8,
style: {
fill: 'transparent'
}
},
{
percent: 1,
style: {
fill: 'black'
}
}
]
}
}
]
}
};
文档
https://echarts.apache.org/zh/option.html#graphic.elements-text
Views: 18 · Posted: 2026-02-10
———         Thanks for Reading         ———
Give me a Star, Thanks:)
https://github.com/fendoudebb/LiteNote扫描下方二维码关注公众号和小程序↓↓↓
Loading...