Skip to content

Instantly share code, notes, and snippets.

@Spartan322
Created October 8, 2022 06:05
Show Gist options
  • Save Spartan322/bab070ead0faea850b822bbd82763886 to your computer and use it in GitHub Desktop.
Save Spartan322/bab070ead0faea850b822bbd82763886 to your computer and use it in GitHub Desktop.
extends Button
onready var normal_press_color = get_stylebox("pressed").bg_color
onready var normal_hover_color = get_stylebox("hover").bg_color
func _ready():
get_stylebox("pressed").bg_color = get_stylebox("hover").bg_color
get_stylebox("hover").bg_color = get_stylebox("normal").bg_color
func _process(_delta):
get_stylebox("hover").bg_color = get_stylebox("hover").bg_color.linear_interpolate(normal_hover_color if is_hovered() else get_stylebox("normal").bg_color, 10*_delta)
get_stylebox("pressed").bg_color = get_stylebox("pressed").bg_color.linear_interpolate(normal_press_color if pressed else get_stylebox("hover").bg_color, 10*_delta)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment