开发者

Simple way to flip rectangle position on the stage

开发者 https://www.devze.com 2023-02-14 17:57 出处:网络
Is there a simple way to take existing rectangle on the stage and \"flip\" the rectangle so that if it was on the left it\'s开发者_Go百科 now on the right side?Yes, it is quite simple by manipulating

Is there a simple way to take existing rectangle on the stage and "flip" the rectangle so that if it was on the left it's开发者_Go百科 now on the right side?


Yes, it is quite simple by manipulating the rectangle's x position.

rectangle.x = stage.stageWidth - rectangle.x - retangle.width;

is about as simple as you can get. It may not be what you're looking for because I have no idea what you're trying to do, but that's how you go about simple position manipulations using variables like the stageWidth.


This should mirror it horizontally:

rectangle.width = -rectangle.width;
0

精彩评论

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

关注公众号