📜  通过代码 cocos 更改精灵框架 - 任何代码示例

📅  最后修改于: 2022-03-11 15:00:33.904000             🧑  作者: Mango

代码示例1
const self = this;
const url = 'test_assets/test_altas/content';
resources.load(url, ImageAsset, (err: any, imageAsset) => {
  const sprite = this.getComponent(Sprite);
  const spriteFrame = new SpriteFrame();
  const tex = new Texture2D();
  tex.image = imageAsset;
  spriteFrame.texture = tex;
  sprite.spriteFrame = spriteFrame;
});