I have a DialogueBox node with the following structure.
When I'm opening and closing the DialogueBox, I animate the rect_size of my
NinePatchRect from (0,0) to (500,64) or vice versa.
Unfortunately, as the box scales up and down, it stays anchored to the position of its topleft corner.
Ideally, I'd like the box to scale up and down while staying positioned at its center.
Event if I set the
NinePatchRect's layout to center, it does not stay centered as it scales.
Further, even if I place the
NinePatchRect in a
CenterContainer, it does not stay centered as it scales (rather, its topleft corner is positoned at the center of the
So, my question:
How do I animate the
rect_size of the NinePatchRect while keeping it centered?
I know I could reposition the
NinePatchRect every frame in
_process() using its current width and height, but this seems very inelegant.
Further, I know I could just animate the
rect_scale and change the
pivot_offset to the center of the
NinePatchRect. The reason I would rather animate the
rect_size is so I can keep the borders a fixed size on my
NinePatchRect as I animate it open and closed.