[]Animation 使用疑问
清理问题 内存没有发生变化
private onBtnClick(): void {
this.body = new Laya.Animation();
this.body.y = -100;
this.body.interval = 50;
this.addChild(this.body);
this.body.play(0, true, "hero_fly");
}
private body: Laya.Animation;
private onBtn2Click(): void {
this.body.destroyChildren();
this.body.clear();
this.body.destroy();
}
调试面板中的sprite个DrwaCall都有变化,但是CurMern么有发出变化,是否正常?
2
构造时创建
constructor() {
this.aniBody = new Animation();
this.aniBody.interval = this.frameNum;
Map.getInstance().heroSprVI.sprCon.addChild(this.aniBody);
this.aniWeapon = new Animation();
this.aniWeapon.interval = this.frameNum;
Map.getInstance().heroSprVI.sprCon.addChild(this.aniWeapon);
this.aniSkillEff = new Animation();
this.aniSkillEff.interval = this.frameNum;
Map.getInstance().heroSprVI.sprCon.addChild(this.aniSkillEff);
this.aniWing = new Animation();
this.aniWing.interval = this.frameNum;
Map.getInstance().heroSprVI.sprCon.addChild(this.aniWing);
}
创建缓存
urls.forEach((urlPath, index) => {
this.xxxx.loadAtlas(urlPath, null, lv + "_" + actionName + "_" + index);
});
播放时大概
playAniBody(actionName: string, direction: number, completeFun: Function = null): void {
this.aniBody.destroyChildren();
this.aniBody.clear();
let loopPlay: boolean = true;
let key: string = actionName + "_" + Math.abs(direction);
this.aniBody.play(0, loopPlay, key);
var bound: Laya.Rectangle = this.aniBody.getBounds();
this.aniBody.pivot(bound.width / 2, bound.height / 2);
if (direction < 0) {
this.aniBody.scaleX = -1;
} else {
this.aniBody.scaleX = 1;
}
}
每改变一个方向CurMern都爆涨50M这样(我的资源body,weapon,skillEff,wing也差不多50M),我在任务管理器中查看chrome的内存大概60M而已,请问内存这一块什么看靠谱点!谢谢
private onBtnClick(): void {
this.body = new Laya.Animation();
this.body.y = -100;
this.body.interval = 50;
this.addChild(this.body);
this.body.play(0, true, "hero_fly");
}
private body: Laya.Animation;
private onBtn2Click(): void {
this.body.destroyChildren();
this.body.clear();
this.body.destroy();
}
调试面板中的sprite个DrwaCall都有变化,但是CurMern么有发出变化,是否正常?
2
构造时创建
constructor() {
this.aniBody = new Animation();
this.aniBody.interval = this.frameNum;
Map.getInstance().heroSprVI.sprCon.addChild(this.aniBody);
this.aniWeapon = new Animation();
this.aniWeapon.interval = this.frameNum;
Map.getInstance().heroSprVI.sprCon.addChild(this.aniWeapon);
this.aniSkillEff = new Animation();
this.aniSkillEff.interval = this.frameNum;
Map.getInstance().heroSprVI.sprCon.addChild(this.aniSkillEff);
this.aniWing = new Animation();
this.aniWing.interval = this.frameNum;
Map.getInstance().heroSprVI.sprCon.addChild(this.aniWing);
}
创建缓存
urls.forEach((urlPath, index) => {
this.xxxx.loadAtlas(urlPath, null, lv + "_" + actionName + "_" + index);
});
播放时大概
playAniBody(actionName: string, direction: number, completeFun: Function = null): void {
this.aniBody.destroyChildren();
this.aniBody.clear();
let loopPlay: boolean = true;
let key: string = actionName + "_" + Math.abs(direction);
this.aniBody.play(0, loopPlay, key);
var bound: Laya.Rectangle = this.aniBody.getBounds();
this.aniBody.pivot(bound.width / 2, bound.height / 2);
if (direction < 0) {
this.aniBody.scaleX = -1;
} else {
this.aniBody.scaleX = 1;
}
}
每改变一个方向CurMern都爆涨50M这样(我的资源body,weapon,skillEff,wing也差不多50M),我在任务管理器中查看chrome的内存大概60M而已,请问内存这一块什么看靠谱点!谢谢
没有找到相关结果
已邀请:
要回复问题请先登录
1 个回复
cuixueying
赞同来自: asdf131