smoother card hover and perk screen exit transition
parent
5876fe992c
commit
e07519ba05
|
|
@ -54,10 +54,13 @@ func select_perk(perk):
|
||||||
_spawn_level_up_particles(get_node("/root/Game/Witch").global_position)
|
_spawn_level_up_particles(get_node("/root/Game/Witch").global_position)
|
||||||
_spawn_level_up_particles(get_node("/root/Game/Player").global_position)
|
_spawn_level_up_particles(get_node("/root/Game/Player").global_position)
|
||||||
perks.erase(perk)
|
perks.erase(perk)
|
||||||
for child in $HBoxContainer.get_children(): child.queue_free()
|
for child in $HBoxContainer.get_children():
|
||||||
|
child.animate_out()
|
||||||
var tween = create_tween()
|
var tween = create_tween()
|
||||||
tween.tween_property($ColorRect, "color:a", 0.0, 0.3)
|
tween.tween_property($ColorRect, "color:a", 0.0, 0.4)
|
||||||
await tween.finished
|
await tween.finished
|
||||||
|
for child in $HBoxContainer.get_children():
|
||||||
|
child.queue_free()
|
||||||
|
|
||||||
func _spawn_level_up_particles(pos: Vector2) -> void:
|
func _spawn_level_up_particles(pos: Vector2) -> void:
|
||||||
var p = _particles_scene.instantiate()
|
var p = _particles_scene.instantiate()
|
||||||
|
|
|
||||||
|
|
@ -148,8 +148,7 @@ func animate_in():
|
||||||
if not is_instance_valid(self):
|
if not is_instance_valid(self):
|
||||||
return
|
return
|
||||||
_hover_tween = create_tween().set_loops()
|
_hover_tween = create_tween().set_loops()
|
||||||
_hover_tween.tween_property(self, "position:y", rest_y - 5.0, 1.0).set_ease(Tween.EASE_IN_OUT).set_trans(Tween.TRANS_SINE)
|
_hover_tween.tween_method(func(t: float): position.y = rest_y + sin(t * TAU) * 5.0, 0.0, 1.0, 2.0)
|
||||||
_hover_tween.tween_property(self, "position:y", rest_y, 1.0).set_ease(Tween.EASE_IN_OUT).set_trans(Tween.TRANS_SINE)
|
|
||||||
|
|
||||||
|
|
||||||
func animate_out():
|
func animate_out():
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue