[Scrapped] Add extendable Animation Component #41
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR was remade into #47.
Adding an Extendable Animation Component
Summary
this Fork adds an Animation Component that allows you to animate various properties of a UI Panel, additional properties can be easily added through future commits (currently only supports opacity & color)
Animations are applied upon creation of the UI, supporting delays & repeaability for convenience & efficiency
Why?
Removing the static feeling from UIs
UI heavy plugins often feel very static, once the UI is on the screen it stays idle until either the server or player does something
Creating Viability
its already possible to create animated UIs with current features, as fadeIn and fadeOut give a degree of animation. this comes at the cost of server strain, very limited possibilities & a difficult developer experience
Setting the foundation
the Component was designed without a specific Purpose (unlike fadeIn and fadeOut), instead focusing on creating a solid base for simple "from - to" animations. a focus was put on including common features like delays & repeatability to remove wasteful strain on the server
The Breakdown
this fork introduces 2 new classes, the
Animation Componentand theAnimationProperty. the component attaches to the panel to start & stop animations. while the AnimationProperty holds the data & coroutine to perform the animation.to use the animation system, a developer can add the component by using the following Json Representation
{ "type":"Animation", "properties": [ { "duration" : 1.0, "delay" : 1.0, "repeat" : 5, "repeatDelay" : 2.5, "type" : "Opacity", "from" : "0.0", "to" : "1.0", } ] },Animation Components can be be used with multiple Properties to create complex Animations, having 2 components on the same panel should be fine but isnt recommended
Usecase & Comparison
Animations shouldn't be used for HUD elements, but for GUIs that are the main focus using animation will make your UI more pleasing to look at & feel more lively
as mentioned, a first degree of animation is already possible thanks to fadeIn & fadeOut, but there are a lot of disadvantages to using it:
to illustrate this i made a quick demo of what an animated UI currently looks like, this is using the existing UI system with timers managed by the server (Watch it here https://streamable.com/b5efj7)
after benchmarking the result it looks.. bad

a decent Animated UI is gonna cost 3 AddUI & 3 Destroy Calls Per Second Per Player, probably not something we want to wast server performance on
this Component lets you achieve
the sameBetter UI with just 2 AddUI & 1 DestroyUI calls (to switch from loading to result screen).Taking it Further
Color & alpha Manipulation are great, but to animate different things we can look to other pending pull requests.
#33 will let us move & scale panels, which would be great to integrate with animations
#27 will allow us to rotate panels, which is also a great addition to animation
there will probably be some sub-forks to add optional support for these forks, as its unsure if they get added (though they should!)
that aside performance is something that could probably be improved on, creating a coroutine for every property may not be most performant either but its guaranteed to be better than the current aproach.