开发者

what is difference between sprite.width VS sprite.scaleX

开发者 https://www.devze.com 2023-04-06 18:10 出处:网络
Both of sprite.width and sprite.sc开发者_运维百科aleX can be used for scale a sprite. Is possible sprite.scaleX depends on screen size?When you change the width property, the scaleX property changes a

Both of sprite.width and sprite.sc开发者_运维百科aleX can be used for scale a sprite. Is possible sprite.scaleX depends on screen size?


When you change the width property, the scaleX property changes accordingly

var rect:Shape = new Shape();
rect.graphics.beginFill(0xFF0000);
rect.graphics.drawRect(0, 0, 100, 100);
trace(rect.scaleX) // 1;
rect.width = 200;
trace(rect.scaleX) // 2;

official documentation


You should read the official documentation about scaleX and width.

By default, scaleX=1 which means there is no rescaling of the sprite, it does not depend on anything, you may set it freely.

0

精彩评论

暂无评论...
验证码 换一张
取 消