# Positioning question (drawing a simple circle)

## Recommended Posts

This may be a ridiculous simple question, but I can't figure this one out...

I tried drawing a circle using the following function:

``drawCircle(x, y, radius)``

Where x and y are according to the documentation of Pixi:

Quote

The X/Y coordinate of the center of the circle

If I want to change the position later, I can use the: circle.position.x or circle.position.y method. If I set both at (2,2) (position.x = 2 and position.y = 2), I see that the position is different than the one I used to create the circle with: drawCircle(2,2,1).

I then don't understand the API's ''the x,y coordinate of the center of the circle''.. Wouldn't that be the initial position of that circle anyway?

##### Share on other sites

The thing is, what you pass in drawCircle is not a position, its coordinates of the circle relative to the graphics you are creating. So you have to use "graphics.drawCircle(0, 0, 1); graphics.position.set(1,1);"

To understand why API works that way, imagine that graphics has two circles in it. Which of two circles position will appear in "graphics.position"?

##### Share on other sites

22 hours ago, ivan.popelyshev said:

The thing is, what you pass in drawCircle is not a position, its coordinates of the circle relative to the graphics you are creating. So you have to use "graphics.drawCircle(0, 0, 1); graphics.position.set(1,1);"

To understand why API works that way, imagine that graphics has two circles in it. Which of two circles position will appear in "graphics.position"?

Thank you Ivan!

## 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.