Change the pivot point of a Control

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By waldson
:warning: Old Version Published before Godot 3 was released.

Hi,

I’m trying to create a button with a scale animation on hover and pressed states, everything works fine, except I can’t find a way to change the pivot point to scale from the center of my button. It always scales from the top left corner. I’ve tried with Spriteand it works, but I still want to use the anchor feature (that is not available on Sprite class). Any idea?

:bust_in_silhouette: Reply From: volzhs

Ability to change scale or rotation for Control is added recently.
with 1.1, can’t do that with Control nodes.
Control is implemented differently with Node2D.
So, Control doesn’t have all functionality with Node2D.

If you want to make animation as you described,
you should use scale and position at the same time for now.

Or, you can make your own Button which inherits Node2D.

Also, don’t forget you can wrap a Control in another Control, and then displace the inner one, while rotating the outer one… Or just use Matrix32 :wink:

Bojidar Marinov | 2016-03-11 15:44