mirror of
https://github.com/niri-wm/niri.git
synced 2026-06-24 02:01:18 +07:00
Use clamped animations where it makes sense
This commit is contained in:
@@ -125,7 +125,7 @@ impl ClosingWindow {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn are_animations_ongoing(&self) -> bool {
|
pub fn are_animations_ongoing(&self) -> bool {
|
||||||
!self.anim.is_done()
|
!self.anim.is_clamped_done()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn render(
|
pub fn render(
|
||||||
@@ -134,7 +134,7 @@ impl ClosingWindow {
|
|||||||
scale: Scale<f64>,
|
scale: Scale<f64>,
|
||||||
target: RenderTarget,
|
target: RenderTarget,
|
||||||
) -> ClosingWindowRenderElement {
|
) -> ClosingWindowRenderElement {
|
||||||
let val = self.anim.value();
|
let val = self.anim.clamped_value();
|
||||||
|
|
||||||
let block_out = match self.block_out_from {
|
let block_out = match self.block_out_from {
|
||||||
None => false,
|
None => false,
|
||||||
|
|||||||
+1
-1
@@ -387,7 +387,7 @@ impl<W: LayoutElement> Tile<W> {
|
|||||||
renderer,
|
renderer,
|
||||||
scale.x as i32,
|
scale.x as i32,
|
||||||
&elements,
|
&elements,
|
||||||
anim.value().clamp(0., 1.) as f32,
|
anim.clamped_value().clamp(0., 1.) as f32,
|
||||||
);
|
);
|
||||||
self.window()
|
self.window()
|
||||||
.set_offscreen_element_id(Some(elem.id().clone()));
|
.set_offscreen_element_id(Some(elem.id().clone()));
|
||||||
|
|||||||
@@ -956,8 +956,10 @@ impl<W: LayoutElement> Workspace<W> {
|
|||||||
|
|
||||||
// FIXME: this is a bit cursed since it's relying on Tile's internal details.
|
// FIXME: this is a bit cursed since it's relying on Tile's internal details.
|
||||||
let (starting_alpha, starting_scale) = if let Some(anim) = tile.open_animation() {
|
let (starting_alpha, starting_scale) = if let Some(anim) = tile.open_animation() {
|
||||||
let val = anim.value();
|
(
|
||||||
(val.clamp(0., 1.) as f32, (val / 2. + 0.5).max(0.))
|
anim.clamped_value().clamp(0., 1.) as f32,
|
||||||
|
(anim.value() / 2. + 0.5).max(0.),
|
||||||
|
)
|
||||||
} else {
|
} else {
|
||||||
(1., 1.)
|
(1., 1.)
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -119,9 +119,7 @@ impl ConfigErrorNotification {
|
|||||||
}
|
}
|
||||||
State::Hiding(anim) => {
|
State::Hiding(anim) => {
|
||||||
anim.set_current_time(target_presentation_time);
|
anim.set_current_time(target_presentation_time);
|
||||||
// HACK: prevent bounciness on hiding. This is better done with a clamp property on
|
if anim.is_clamped_done() {
|
||||||
// the spring animation.
|
|
||||||
if anim.is_done() || anim.value() <= 0. {
|
|
||||||
self.state = State::Hidden;
|
self.state = State::Hidden;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user