Open gzhanghui opened 5 years ago
对应文档-点线运动
afterDraw(cfg, group) { const shape = group.get('children')[0]; const length = 200; //先写死,后续 G 增加 totalLength 的接口 let totalArray = []; // 计算出整条线的 lineDash for (var i = 0; i < length; i += interval) { totalArray = totalArray.concat(lineDash); } let index = 0; shape.animate({ onFrame(ratio) { const cfg = { lineDash: dashArray[index].concat(totalArray) }; index = (index + 1) % interval; return cfg; }, repeat: true }, 3000); }
对应文档-点线运动