# Rotation tween around arbitary point

## Recommended Posts

Hi!

I'm new to Phaser and are trying to make a simple game in which you can rotate the game board (90 degree steps). on the board there's a a few blocks that should be rotated along with the board. To rotate the board and the blocks around their center anchor points work well with tweens but I haven't managed to get the blocks to rotate nicely along with the board as described in the picture.

So far my best solution is to tween the block positions but that doesn't look very good.

var goal = new Phaser.Point(this._block.x, this._block.y);goal.rotate(this._center.x, this._center.y, -90, true);this.add.tween(this._block).to({x: goal.x, y: goal.y}, 750, Phaser.Easing.Linear.None, true, 100);

I guess i could set the anchor point of each block to the center and then rotate, but how do I translate the board center position to the anchor point format? I could calculate a few points in an arc and interpolate between them. I also heard about tweening in bezier curves.

Al this sounds like a bit of overkill, there must be an easier way? My first 10 Google pages are all purple

##### Share on other sites

I am not fully sure if I got your problem, but I would add board and blocks in one group and rotate this group. Thus I wouldn't deal with each object individually but make one single tween for group.

##### Share on other sites

Of course! I haven't been playing around with Phaser long enough to realize you could tween whole groups. That's exactly what I needed:) Thanks a lot!

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.