Refactor AnimationPlayer
's API to be similar to Tween
's API
#4915
Diddykonga
started this conversation in
Engine Core
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Inspiration:
The new implementation of
Tween
for 4.0 was quite nice, and am personally a fan of the Factory / Builder Pattern.I think that
AnimationPlayer
would benefit from the same API style, and should still be able to provide for all of the same use cases as before.Description:
AnimationPlayer
's API could be refactored to work similar toTween
if we were to introduce a new Type such as:AnimationSequence
(naming is just for the example)Which could work similar to the
Tweener
s, implementation varying, in that you can use Builder Pattern on them to tweak their timing/playback/etc.This could also allow,
AnimationNode
's more special animation features(AddxD
, etc.), to be added asAnimationSequence
methods.Example GDScript:
For simple uses,
play/queue_animation("AnimationName", loops?, blend-in?, blend-out?, backwards?)
should still be available. It will act as a quick helper method for building a single animation sequence, with the modifiers from the parameters applied.As you may be able to tell from the example, this is not about changing what the
AnimationPlayer
plays, but instead changing how the user/developer interacts and uses theAnimationPlayer
to playAnimation
s. It is an enhancement, which still supports previous use cases, but will provide for much more as well.Extra:
As this doesn't necessarily pertain to this topic, if this where to be accepted, we should look to separate/duplicate the
AnimationNodeStateMachine
out to justStateMachine : Node/Resource
, as it seems a StateMachine would be useful outside of just Animation.Beta Was this translation helpful? Give feedback.
All reactions