diff --git a/MyObsidianVault/Godot_Training/2D/Tutorial Game 4 - Telling a story/M7.L11 - Animate Sophia sliding in/Node opacity.md b/MyObsidianVault/Godot_Training/2D/Tutorial Game 4 - Telling a story/M7.L11 - Animate Sophia sliding in/Node opacity.md new file mode 100644 index 0000000..f9aed2f --- /dev/null +++ b/MyObsidianVault/Godot_Training/2D/Tutorial Game 4 - Telling a story/M7.L11 - Animate Sophia sliding in/Node opacity.md @@ -0,0 +1 @@ + A UI nodes' opacity is modified via the modulate property which controls the tinting of the node. \ No newline at end of file diff --git a/MyObsidianVault/Godot_Training/2D/Tutorial Game 4 - Telling a story/M7.L11 - Animate Sophia sliding in/Tweens.md b/MyObsidianVault/Godot_Training/2D/Tutorial Game 4 - Telling a story/M7.L11 - Animate Sophia sliding in/Tweens.md new file mode 100644 index 0000000..d8322e9 --- /dev/null +++ b/MyObsidianVault/Godot_Training/2D/Tutorial Game 4 - Telling a story/M7.L11 - Animate Sophia sliding in/Tweens.md @@ -0,0 +1,28 @@ +Tweens are created using a nodes' create_tween() method + + +```python +func slide_in() -> void: + var tween := create_tween() + tween.set_trans(Tween.TRANS_QUART) + tween.set_ease(Tween.EASE_OUT) +```` + +Running tweens in parallel via parallel method. +Modulate controls tinting, subproperty a is for alpha, meaning a target visibilty of 100% +```python +tween.parallel().tween_property(body, "modulate:a", 1.0, 0.2) +``` + + +Full tween method: +```python +func slide_in() -> void: + var tween = create_tween() + tween.set_trans(Tween.TRANS_QUART) + tween.set_ease(Tween.EASE_OUT) + body.position.x = 200.0 + tween.tween_property(body, "position:x", 0.0, 1.0) # Move x from 200 to 0 + body.modulate.a = 0.0 # UI node visibility = 0 + tween.parallel().tween_property(body, "modulate:a", 1.0, 1.0) # Animate visibility towards 100% (a=alpha) +``` \ No newline at end of file