UIButtonHoverRotate

Contents

UIButtonHoverRotate#

NAMESPACE:

UnityUtils.ScriptUtils.UI

The UIButtonHoverRotate script is used to quickly add rotation animation to buttons.

Usage#

Add a ‘UIButtonHoverRotate’ Script to a UI button and when you hover over the button the button will rotate! See below for the customizable values on the script.

Functions#

UnityUtils.ScriptUtils.UI.UIButtonHoverRotate : MonoBehaviour , IPointerEnterHandler , IPointerExitHandler

Public Members

float hoverRotation = 8f#

When hovered this is the rotation the button will be set to.

float rotationAnimationSeconds = 0.1f#

The amount of seconds that the button will rotate in.

bool rotateBackAfterHover = true#

If true the button will rotate to the set position, the rotate back on hover. If false the buton will rotate to the set position, then only rotate back when unhovering.

bool useRealtime = true

true to use unscaled real time for the animation (ignoring time scale).

AnimationCurve SizingCurve = AnimationCurve.EaseInOut(0, 0, 1, 1)

The AnimationCurve that the button will follow.

bool useRandomRotation = false#

Not required, but if true rotation will use random rotation.

Vector2 randomRotation = new Vector2(-5f, 5f)#

The min/max values to use in random rotation.

Transform applyTransform

The object to apply the transform to (Default’s to the applied object).

bool hoveringOverButton

True if the button is being hovered.

bool logRotate#

Log on any rotate.

bool logRotateSetPos#

Log first rotate to set rotation.

bool logRotateBack#

Log second rotate back to default rotation.

bool logRandomRotation#

If useRandomRotation is true, will log when the random pos is generated.