1 class_name DialogicAnimation
4 ## Class that can be used to animate portraits. Can be extended to create animations.
6 enum AnimationType {IN=1, OUT=2, ACTION=3, CROSSFADE=4}
11 ## Set at runtime, will be the node to animate.
14 ## Set at runtime, will be the length of the animation.
17 ## Set at runtime, will be the base position of the node.
18 ## Depending on the animation, this might be the start, end or both.
19 var base_position: Vector2
20 ## Set at runtime, will be the base scale of the node.
21 var base_scale: Vector2
23 ## Used to repeate the animation for a number of times.
26 ## If `true`, the animation will be reversed.
27 ## This must be implemented by each animation or it will have no effect.
28 var is_reversed: bool = false
31 func _ready() -> void:
32 finished_once.connect(finished_one_loop)
35 ## To be overridden. Do the actual animating/tweening in here.
36 ## Use the properties [member node], [member time], [member base_position], etc.
37 func animate() -> void:
41 ## This method controls whether to repeat the animation or not.
42 ## Animations must call this once they finished an animation.
43 func finished_one_loop() -> void:
55 node.process_mode = Node.PROCESS_MODE_DISABLED
58 func resume() -> void:
60 node.process_mode = Node.PROCESS_MODE_INHERIT
63 func _get_named_variations() -> Dictionary:
67 ## If the animation wants to change the modulation, this method
68 ## will return the property to change.
70 ## The [class CanvasGroup] can use `self_modulate` instead of `modulate`
71 ## to uniformly change the modulation of all children without additively
72 ## overlaying the modulations.
73 func get_modulation_property() -> String:
74 if node is CanvasGroup:
75 return "self_modulate"