1
0
Fork 0
forked from wry/wry

Add custom animation curve config

This commit is contained in:
atagen 2026-05-21 17:19:46 +10:00
parent fa5c28ca3d
commit cf61c080b6
10 changed files with 281 additions and 57 deletions

View file

@ -1619,6 +1619,14 @@ impl State {
.set(AnimationCurve::from_config(curve));
}
pub fn set_animation_cubic_bezier(&self, x1: f32, y1: f32, x2: f32, y2: f32) -> bool {
let Some(curve) = AnimationCurve::from_cubic_bezier(x1, y1, x2, y2) else {
return false;
};
self.animations.curve.set(curve);
true
}
pub fn with_layout_animations<T>(&self, f: impl FnOnce() -> T) -> T {
let prev_requested = self.layout_animations_requested.replace(true);
let prev_active = self.layout_animations_active.replace(true);