-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Example loading spinners #1902
Example loading spinners #1902
Conversation
Iced aw has some spinners https://github.com/iced-rs/iced_aw/blob/main/src/native/spinner.rs |
examples/loading_spinners/Cargo.toml
Outdated
iced = { path = "../..", features = ["canvas"] } | ||
iced_core = { path = "../../core" } | ||
iced_widget = { path = "../../widget" } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should be able to rely solely on iced
if you enable the advanced
feature, which will expose the advanced
module.
See the custom_widget
example:
iced/examples/custom_widget/src/main.rs
Lines 12 to 15 in c15f1b5
use iced::advanced::layout::{self, Layout}; | |
use iced::advanced::renderer; | |
use iced::advanced::widget::{self, Widget}; | |
use iced::{Color, Element, Length, Point, Rectangle, Size}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh cool, I also forgot to remove the flo_curves dependency now that it is instead using lyon for the easing curves. Updated in 56eacdb
Requesting We should be able to efficiently incrementally re-render eventually, however! |
I see, I've updated to use |
Nice! I didn't realize that was there. If this PR is unnecessary then or more appropriate elsewhere I can close / move it. |
style: <Theme as StyleSheet>::Style, | ||
easing: &'a Easing, | ||
cycle_duration: Duration, | ||
rotaion_duration: Duration, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is an error here rotaion
should be rotation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, fixed it in 9d69af1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really cool example! Thanks 🥳
This PR adds an example of how to implement animated loading spinner widgets. I went with the material design style because the animation easing curves etc are described in detail, but the colors can be changed through the theme, & the speed+sizing through the example widgets' APIs.
spinners.mov
TODO:
RedrawRequest::At()
, which may allow for some throttling/debouncing if necessary.