[LayaNative 2.0]laya2.3图集含空白裁切后,锚点旋转bug,demo重现

已邀请:

18857358473

赞同来自:

var tx3:Laya.Texture = Laya.loader.getRes("test2.png");
        var sp3:Laya.Sprite = new Laya.Sprite();
        sp3.texture = Laya.Texture.create(tx3,0,0,315,315,134,134,582,582);
         sp3.pivot(315/2,315/2);//锚点使用实际裁切后的中心反而是对的,这按理是bug吧
        // sp3.pos(Laya.stage.width/2,0);
        Laya.stage.addChild(sp3);
        Laya.timer.frameLoop(2,null,function()
            {
                sp3.rotation = sp3.rotation+10;
            }
        );

Aar0n

赞同来自:

这个sprite 没有设置宽高, 所以它宽高就是 纹理的宽高,纹理是被裁剪的,所以是315了

18857358473

赞同来自:

        var sp:Laya.Sprite = new Laya.Sprite();//旋转的图片
        sp.texture = tx;
        sp.pivot(291,291);//锚点设中心
        sp.size(582,582);//设置原图大小 这样设锚点是中心点了,但是显示被放大了
        sp.pos(Laya.stage.width/2,0);
        Laya.stage.addChild(sp);
        Laya.timer.frameLoop(2,null,function()
            {
                sp.rotation = sp.rotation+10;
            }
        );

要回复问题请先

商务合作
商务合作