[错误] yoyo 的值有误
demo.ts
const rootEl = document.getElementById("root"); Object.assign(rootEl.style, { width: "800px", height: "600px", });
rootEl.innerHTML = "loading";
const dataX = []; const dataY = [];
let i = 0; createAnimationQueue({ from: { value: 1 }, to: { value: 1.5 }, yoyo: true, repeat: 3, onUpdate: (o) => { dataX.push(i++); dataY.push(o.value); }, onComplete: () => { const chart = ec.init(rootEl); chart.setOption({ xAxis: { type: "category", data: dataX, }, yAxis: { type: "value", }, series: [ { data: dataY, type: "line", }, ], }); }, });
内容来源: tweenjs/tween.js