28 lines
820 B
Markdown
28 lines
820 B
Markdown
|
|
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)
|
||
|
|
```
|