From 21c8844377732e3031367cec5340e0d32ae25556 Mon Sep 17 00:00:00 2001 From: Jason Lee Date: Tue, 24 Jun 2025 17:25:55 +0800 Subject: [PATCH] notification: Improve Notification animation. (#1003) --- crates/ui/src/notification.rs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/crates/ui/src/notification.rs b/crates/ui/src/notification.rs index 3f1da662..c6bc452f 100644 --- a/crates/ui/src/notification.rs +++ b/crates/ui/src/notification.rs @@ -319,15 +319,22 @@ impl Render for Notification { ) .with_animation( ElementId::NamedInteger("slide-down".into(), closing as u64), - Animation::new(Duration::from_secs_f64(0.15)) + Animation::new(Duration::from_secs_f64(0.25)) .with_easing(cubic_bezier(0.4, 0., 0.2, 1.)), move |this, delta| { if closing { let x_offset = px(0.) + delta * px(45.); - this.left(px(0.) + x_offset).opacity(1. - delta) + let opacity = 1. - delta; + this.left(px(0.) + x_offset) + .shadow_none() + .opacity(opacity) + .when(opacity < 0.85, |this| this.shadow_none()) } else { let y_offset = px(-45.) + delta * px(45.); - this.top(px(0.) + y_offset).opacity(delta) + let opacity = delta; + this.top(px(0.) + y_offset) + .opacity(opacity) + .when(opacity < 0.85, |this| this.shadow_none()) } }, )