
代码GifFrameAni.ts,一看就会用。
gif.zip (10.1 KB)
图不错,拿走了
我下载了用,好像不太行,在lateUpdate有看到数字在动,然后frameList里也有元素,但是就是不能播放
有可能是libgif 的问题。你可以研究下 
好的,谢谢啦
MarkMarkMark
async refresh() {
this._inited = false;
this.frameList = [];
if (!this.assetIsGif(this._asset)) {
return;
}
let gif = new Image();
gif.src = this._asset.nativeUrl;
await new Promise<Event>((ok, fail) => {
gif.onload = ok;
gif.onerror = fail;
});
let superGif = new SuperGif({ gif: gif });
await superGif.load();
for (let i = 0; i <= superGif.getLength(); i++) {
superGif.moveTo(i);
let oldCanvas = superGif.getCanvas();
let canvas = document.createElement('canvas');
canvas.width = oldCanvas.width;
canvas.height = oldCanvas.height;
canvas.getContext('2d').drawImage(oldCanvas, 0, 0);
let tex = new cc.Texture2D();
tex.initWithElement(canvas);
// 新版无需 handleLoadedTexture
this.frameList.push(new cc.SpriteFrame(tex));
}
superGif.destroy();
superGif = null;
this._inited = true;
this._setFrame(0);
}
我的版本是2.4.15,修改代码中的就可以了
mark~~~~~~~~
mark大人,囤了很多资源了吧
只mark,不用
