新疑问,
入口类
Entry.ts
/*
* 游戏入口;
*/
class Entry{
constructor(){
//程序入口
Laya.init(400, 400, Laya.WebGL);
let res:any = [];
res.push({url:"res/atlas/comp.atlas", type:Loader.ATLAS});
Laya.loader.load(res, Handler.create(null, this.__onLoaded));
}
private __onLoaded(): void {
Laya.stage.addChild(new Test());
}
}
new Entry();
Test.ts
import Sprite = Laya.Sprite;
class Test extends Sprite{
constructor(){
super();
this._initView();
}
private _initView():void {
let sprite:Sprite = new Sprite();
sprite = new Sprite();
sprite.graphics.drawCircle(0, 0, 50, "#0000ff");
sprite.scale(2, 2);
this.x = 100;
this.addChild(sprite);
}
}
按道理,我只是缩放子对象sprite,缩放的中心点就是按子对象
的计算,而且子对象和Test的锚点都是(0, 0),正确的效果,应该画出来的圆的相对舞台中心坐标还是(100,0)
但现在的结果是
不知道是不是我理解错了