Use this space for questions related to what you're learning. For any other type of support (website, learning platform, payments, etc...) please get in touch using the contact form.
Dani's animationburandoriI have a question. Why doesn't Dani enter with the entrance animation that goes from right to left?. By the way, the course is amazing. I've already bought several packages and I love it20Aug. 13, 2023
Using AnimationPlayer but having any duration you want through codeeh_jogosJust an alternative it you want to use AnimationPlayer for the fade transitions, but would like to be able to pass any duration to the transition through data:
1. First make your animations have 1 second
2. your data will need to have an optional "duration" key:
```gdscript
{
transition = "fade_in",
duration = 0.5,
},
```
3. Add a duration parameter to the fade functions:
```gdscript
func _appear_async(duration := 0.7) -> void:
_anim_player.play("fade_in", -1, 1.0/duration)
yield(_anim_player, "animation_finished")
yield(_text_box.fade_in_async(), "completed")
emit_signal("transition_finished")
func _disappear_async(duration := 0.7) -> void:
yield(_text_box.fade_out_async(), "completed")
_anim_player.play("fade_out", -1, 1.0/duration)
yield(_anim_player, "animation_finished")
emit_signal("transition_finished")
```
What happens here is that you can give [AnimationPlayer.play() function](https://docs.godotengine.org/en/3.5/classes/class%5Fanimationplayer.html#class-animationplayer-method-play) a custom playback speed in the third parameter, and if the animation duration is 1 second, 1.0 / desired_duration will always give a playback speed that will be of the duration you want. We have to give a -1 before the custom speed because as you can see in the documentation linked above there is a "custom_blend" optional parameter before the "custom_playback_speed" one.
4. On transition data elif, use the duration in the node dictionary:
```gdscript
...
elif "transition" in node:
call(TRANSITIONS[node.transition], event_data.get("duration", 0.7))
yield(self, "transition_finished")
key = node.next
...
```
It's probably better to have a constant for the default transition duration, but that's it.10Mar. 13, 2023
Lesson Q&A
Use this space for questions related to what you're learning. For any other type of support (website, learning platform, payments, etc...) please get in touch using the contact form.