[ActionScript]Spriteを真ん中を中心に回転させる
Posted on 7 月 26th, 2009 by kude
自分用メモです。
Spriteを、その真ん中を中心にして回転させたいとき。
いろいろやり方はあるだろうけど、回転の前後でgetBoundsの中心が一致するように、Spriteを移動させてやるのが簡単でいいのではないかな。
var rect0:Rectangle = getBounds(parent);
rotation = value;
var rect1:Rectangle = getBounds(parent);
x -= rect1.x - rect0.x + (rect1.width - rect0.width) / 2;
y -= rect1.y - rect0.y + (rect1.height - rect0.height) / 2;
Filed under: Flash/AIR/Flex, メモ



