0

If i rotate image in EaselJS it rotates around 0,0 point how do i move it? Ty! Ras

Rasovica
  • 239
  • 1
  • 4
  • 14

2 Answers2

5

Subclasses of DisplayObject (Bitmap, Text, Shape, etc.) support regX and regY properties, which let you change the registration point of the object from the default:

I've found this helpful not just for rotation, but other effects as well, such as controlling how a Bitmap flips when setting a negative scaleX/Y.

Best, Chris

Metafaniel
  • 29,318
  • 8
  • 40
  • 67
Chris Bowen - MSFT
  • 9,589
  • 1
  • 17
  • 13
  • Yes you're right, that's the best way to do it. I have just posted [THIS QUESTION](http://stackoverflow.com/questions/15794748/resize-a-draggable-fill-with-easeljs) If I set the registration point of a simple shape, then it's x and y properties are altered and the shape it's moved. Can you please help me? =) – Metafaniel Apr 03 '13 at 18:28
3

You need to use translate(x,y) where x and y are the new rotation center you want.

Note: If you need to keep operating further, remember to un-translate it (translate again with same but negative values) after you are done with rotation, for this you will need to take into account how much you rotated it.

Bigger
  • 1,807
  • 3
  • 18
  • 28