Rotate images - Change Center of Rotation

Hi all,


I have a problem with an animation I'm working on for my mv project.


I use this code:


this.rotation =  angle * Math.PI / 180;


But my image rotates following the top left corner.


I need my image to rotate at it's center.


My image is a bitmap


I need something like


this.translate( canvasRotationCenterX, canvasRotationCenterY );


Does rpgmaker have something similar to this?


Can anyone point me to the right direction?


Thank you.


All the best,


Mycael
What is 'this'?  A Sprite?  a Sprite_Base?


this.anchor.x = 0.5;


this.anchor.y = 0.5;


will set the anchor/origin to the center of the image.


Please don't post the same question multiple times in different places.  The mods will move it if it's in the wrong forum (or you can report it and ask it to be moved).
Hi,


Thank you for the reply.


Sorry for double posting. I thought my first post wasn't sent.


About my image.


My bitmap object is associated with windows.


So, I use 


this.contents.blt(bitmap, 0, 0, pw, ph, 0, 0); 


to run my image.


I can't seem to use anchor.x and anchor.y


anchor is undefined. Thanks
What is 'this'? A Sprite? a Sprite_Base?


this.anchor.x = 0.5;


this.anchor.y = 0.5;


will set the anchor/origin to the center of the image.


Please don't post the same question multiple times in different places. The mods will move it if it's in the wrong forum (or you can report it and ask it to be moved).
i got the very same problem , i don't want to send a duplicate post since this one already reply-able

i don't know how to set anchor.x, can you tell me? i want to write this in a plugin js file

thank Shaz!
Necro-post notice: @RyanYe

Our necroposting rules apply whether the thread has been closed or not. The OP already had an idea where the code needed to go, even in their response. And you have not indicated what sort of images you are trying to rotate either, so we can't tell you anything more than what's already above.

Please start your own new thread and provide enough detail about what you're trying to do so we're not just guessing at possible solutions.

Original thread: https://forums.rpgmakerweb.com/threads/rotate-images-change-center-of-rotation.60846/