1
0
Fork 0
forked from wry/wry

feat: add window animations

This commit is contained in:
atagen 2026-05-21 15:20:46 +10:00
parent a29937ebe8
commit ce14169d6b
29 changed files with 6957 additions and 114 deletions

View file

@ -103,6 +103,27 @@ impl Axis {
}
}
/// The curve used for tiled window animations.
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
pub struct AnimationCurve(pub u32);
impl AnimationCurve {
pub const LINEAR: Self = Self(0);
pub const EASE: Self = Self(1);
pub const EASE_IN: Self = Self(2);
pub const EASE_OUT: Self = Self(3);
pub const EASE_IN_OUT: Self = Self(4);
}
/// The presentation style used for tiled window movement animations.
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
pub struct AnimationStyle(pub u32);
impl AnimationStyle {
pub const PLAIN: Self = Self(0);
pub const MULTIPHASE: Self = Self(1);
}
/// Exits the compositor.
pub fn quit() {
get!().quit()
@ -287,6 +308,42 @@ pub fn set_ui_drag_threshold(threshold: i32) {
get!().set_ui_drag_threshold(threshold);
}
/// Enables or disables tiled window animations.
///
/// The default is `false`.
pub fn set_animations_enabled(enabled: bool) {
get!().set_animations_enabled(enabled);
}
/// Sets the duration of tiled window animations in milliseconds.
///
/// The default is `160`.
pub fn set_animation_duration_ms(duration_ms: u32) {
get!().set_animation_duration_ms(duration_ms);
}
/// Sets the curve used by tiled window animations.
///
/// The default is [`AnimationCurve::EASE_OUT`].
pub fn set_animation_curve(curve: AnimationCurve) {
get!().set_animation_curve(curve.0);
}
/// Sets the presentation style used for tiled window movement animations.
///
/// The default is [`AnimationStyle::MULTIPHASE`].
pub fn set_animation_style(style: AnimationStyle) {
get!().set_animation_style(style.0);
}
/// Sets a custom cubic-bezier curve used by tiled window animations.
///
/// `x1` and `x2` must be between `0.0` and `1.0`. The curve starts at `(0, 0)`
/// and ends at `(1, 1)`.
pub fn set_animation_cubic_bezier(x1: f32, y1: f32, x2: f32, y2: f32) {
get!().set_animation_cubic_bezier(x1, y1, x2, y2);
}
/// Enables or disables the color-management protocol.
///
/// The default is `false`.