正规在js网页上读取图片并不是使用cc.loader.load,而是url(./xxxx)
例如在cocos内打入
loadingBG : HTMLElement;
onLoad () {
this.loadingBG = document.createElement(“div”);
this.loadingBG.style.backgroundColor = “#fafbd8”;
this.loadingBG.style.opacity = “1”;
this.loadingBG.style.position = “absolute”;
this.loadingBG.style.width = “0%”;
this.loadingBG.style.height = “0%”;
this.loadingBG.style.top = “0”;
this.loadingBG.style.left = “0”;
this.loadingBG.style.background = “#171717 url(./favicon.ico) no-repeat center”;
this.loadingBG.style.backgroundSize = “450px”;
document.body.appendChild(this.loadingBG);
}
则可以压一张大的cocos的logo在专案内当作loading条
loading完成时可以把这个HTMLElement给remove掉
问题:
有没有办法把这个url(./favicon.ico)转换成spriteframe?
(我想直接用这样的读取方式读取档案应该会比cc.loader.load的url还要快,毕竟是本地文件读取)