wip: animations for default widgets #1855
Closed
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.
Hi!
This WIP implements default animations for default widgets. The goal here is to make Iced application appear smooth when hovering / clicking things, without breaking the API. It is also possible to keep the actual behavior (using a simple enum), although I do not know which should be default.
This heavily uses the new frame subscription API.
This is one thing that I was missing since transitioning from GTK, where you don't really need to worry about animations but can still end up with something that looks nice and smooth.
Current progress
Buttons
Buttons have smooth color transitions when hovered and pressed.
Kooha-2023-05-15-23-28-06.mp4
Things to discuss and fix:
Hovered
event in theupdate()
function?Text input (cursor)
In the text input, the cursor will fade-blink. It will however remain a full opacity while typing
Kooha-2023-05-15-23-36-43.mp4
Radio buttons
Radio buttons have smooth color transitions when hovered and pressed.
Kooha-2023-05-15-23-40-07.mp4
Togglers
Togglers have smooth color and movements transitions when pressed.
Kooha-2023-05-15-23-44-52.mp4
To do
Interferences
I stumbled upon cosmic-time, which implements a framework for animations in iced. From what I understand, it is made for more complex animations to be implemented by the user, whereas my goal is to bring default animations to Iced. However, I do not know if it would be better to use what has been made for cosmic-time for this or not. Or maybe this WIP is better suited to be used in cosmic-time after all.
I think default animations would be great, at least to be on par with GTK, but that's just IMO!
Thanks!