]> Untitled Git - wolf-seeking-sheep.git/blob - addons/dialogic/Modules/Character/DefaultAnimations/fade_in_out.gd
Updated export config options
[wolf-seeking-sheep.git] / addons / dialogic / Modules / Character / DefaultAnimations / fade_in_out.gd
1 extends DialogicAnimation
2
3 func animate() -> void:
4
5         var modulation_property := get_modulation_property()
6         var end_modulation_alpha := 1.0
7
8         if is_reversed:
9                 end_modulation_alpha = 0.0
10
11         else:
12                 var original_modulation: Color = node.get(modulation_property)
13                 original_modulation.a = 0.0
14                 node.set(modulation_property, original_modulation)
15
16         var tween := (node.create_tween() as Tween)
17         if is_reversed:
18                 tween.set_ease(Tween.EASE_IN)
19         else:
20                 tween.set_ease(Tween.EASE_OUT)
21         tween.set_trans(Tween.TRANS_SINE)
22         tween.tween_property(node, modulation_property + ":a", end_modulation_alpha, time)
23
24         await tween.finished
25         finished_once.emit()
26
27
28 func _get_named_variations() -> Dictionary:
29         return {
30                 "fade in": {"reversed": false, "type": AnimationType.IN},
31                 "fade out": {"reversed": true, "type": AnimationType.OUT},
32                 "fade cross": {"type": AnimationType.CROSSFADE},
33         }
34