[LayaAir3]layaair3.1.3 2d cacheAs 不起着用?
let textBox = new Sprite();
this.owner.addChild(textBox);
// 随机摆放文本
let text;
for (let i = 0; i < 1000; i++) {
text = new Text();
textBox.addChild(text);
text.fontSize = 20;
text.text = (Math.random() * 100).toFixed(0);
text.rotation = Math.random() * 360;
text.color = "#ccc";
text.x = Math.random() * this.pageWidth;
text.y = Math.random() * this.pageHeight;
}
//缓存为静态图像
textBox.cacheAs = "normal";
this.owner.addChild(textBox);
// 随机摆放文本
let text;
for (let i = 0; i < 1000; i++) {
text = new Text();
textBox.addChild(text);
text.fontSize = 20;
text.text = (Math.random() * 100).toFixed(0);
text.rotation = Math.random() * 360;
text.color = "#ccc";
text.x = Math.random() * this.pageWidth;
text.y = Math.random() * this.pageHeight;
}
//缓存为静态图像
textBox.cacheAs = "normal";
没有找到相关结果
已邀请:
1 个回复
layaAir小孟
赞同来自:
不开启cacheAs的效果:
开启cacheAs的效果: