rexrainbow / phaser3-rex-notes

Notes of phaser3 engine
MIT License
1.2k stars 260 forks source link

Can I Change Origin of Img in BB Code Text? #343

Closed rexrainbow closed 1 year ago

rexrainbow commented 1 year ago
    Hello Rex, I hope this message finds you well. I've been using your plugins and they've been working great for me. I'm looking to add an img button to my BB CODE TEXT and apply an animation that changes the size of the image depending on mouse input. I've been using addImage to adjust the size, but when I run updateText, the origin of the image is always at 0,0, which causes it to expand only to the bottom-right. Is there a way to change the origin of the img to 0.5,0.5?

Originally posted by @rtlqwm324 in https://github.com/rexrainbow/phaser3-rex-notes/discussions/342

rexrainbow commented 1 year ago

@rtlqwm324

Add originX, originY into parameter of image. See this demo, line 23, 24. However, it is better using sprite game object directly, to have better position controlling.

rtlqwm324 commented 1 year ago

This is exactly what I've been looking for. Thank you so much.