assistant panel: Animate assistant label if message is pending (#16152)

This adds a pulsating effect to the assistant header in case the message
is pending.

The pulsating effect is capped between 0.2 and 1.0 and I tried (with the
help of Claude) to give it a "breathing" effect, since I found the
normal bounce a bit too much.

Also opted for setting the `alpha` on the `LabelLike` things, vs.
overwriting the color, since I think that's cleaner instead of exposing
the color and mutating that.


https://github.com/user-attachments/assets/4a94a1c5-8dc7-4c40-b30f-d92d112db7b5


Release Notes:

- N/A
This commit is contained in:
Thorsten Ball 2024-08-13 11:41:44 +02:00 committed by GitHub
parent b36d1386a9
commit af36d4934c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 98 additions and 10 deletions

View file

@ -156,6 +156,20 @@ impl LabelCommon for Label {
self.base = self.base.italic(italic);
self
}
/// Sets the alpha property of the color of label.
///
/// # Examples
///
/// ```
/// use ui::prelude::*;
///
/// let my_label = Label::new("Hello, World!").alpha(0.5);
/// ```
fn alpha(mut self, alpha: f32) -> Self {
self.base = self.base.alpha(alpha);
self
}
}
impl RenderOnce for Label {