iced icon indicating copy to clipboard operation
iced copied to clipboard

Animate the `radio` widget

Open bradysimon opened this issue 10 months ago • 1 comments

Overview

This PR uses the new animation API to animate the radio widget. The current animation scales/fades the dot icon as the is_selected state changes.

This also gates the animation behind a new animations feature that Hector specified and adds an optional animations feature to the scrollable example to demonstrate this change. To test this change locally:

  • with animations: cargo run -p scrollable --features animations
  • without animations: cargo run -p scrollable

Preview

Here's what the animation looks like (in light mode since the radio in dark mode isn't as clear):

https://github.com/user-attachments/assets/8e29bb6a-d392-48ec-a953-f09cf5d85544

Side note: Hector mentioned on Discord to avoid animating more complex types like colors/backgrounds, so this PR doesn't add any general Style animation. Only f32/bool animations for now.

bradysimon avatar Jan 31 '25 00:01 bradysimon

An alternative animation would be to make the dot scale from a size of zero to its final size. I think I prefer the current animation but I want to at least present both options:

https://github.com/user-attachments/assets/c3f6332a-a371-429c-8fe7-587019cc9cb8

bradysimon avatar Jan 31 '25 15:01 bradysimon