Loading.gd 742 B

12345678910111213141516171819202122232425
  1. extends Control
  2. #
  3. @export_range (0.1, 10.0) var speed : float = 2.0
  4. @onready var progress : TextureProgressBar = $Progress
  5. var currentTween : Tween = null
  6. #
  7. func _on_visibility_changed() -> void:
  8. if visible and Launcher.GUI and Launcher.GUI.progressTimer:
  9. currentTween = create_tween()
  10. currentTween.set_loops(Launcher.GUI.progressTimer.time_left / speed)
  11. currentTween.tween_property(progress, "radial_initial_angle", 360, speed).from(0)
  12. currentTween.play()
  13. create_tween().set_parallel(true).tween_property(progress, "modulate:a", 1.0, speed).set_ease(Tween.EASE_IN)
  14. else:
  15. if currentTween:
  16. currentTween.stop()
  17. currentTween = null
  18. if progress:
  19. progress.modulate.a = 0
  20. func _ready():
  21. progress.modulate.a = 0