shinku / gif

libgif.js && gif.worker.js
18 stars 8 forks source link

canvas里通过getImageData如何拿到最新的帧数组frames #3

Closed duanxb closed 3 years ago

duanxb commented 3 years ago

//frames 为最新的gif 帧数组 const tasks=[]; const newData = []; frames.forEach((item,index)=>{ tasks.push({ index, data:item.data last: index === frames.length - 1, delay: item.delay*10, width:item.w, height:item.h, quality:10, debug: false, dither: true, transparent:true, globalPalette:false, repeat:0, background:"#000000", canTransfer:true }) gworker.postMessage(tasks[index]); }); 图片数据可以通过getImageData拿到,delay 怎么拿到呢?