Centering an image sprite in a canvas

Hello fam.I tried to research some topic in the previous, but don’t find any better answer. If you have time to share or discuss how to exactly proportion an image sprite in a center of a canvas.
Thank you for those who can figure it out. Much love

image sprite width = canvas width/2 - image sprite width/2

Or not?

thanks for the response @Mika. I also tried that blocks, but don’t exactly centered proportion.

Here is a topic for fab center:

Use it as example for your calculation


I use the same method as Mika:
Image sprite x = (canvas width/2) - (image sprite width/2)
Image sprite y = (canvas height/2) - (image sprite height/2)

If you’re using the ball component then instead of (image sprite width/2), minus radius instead

1 Like