forge
Explore
Log in

Don't you dare go Hollow

Use clamped animations where it makes sense

Browse files at this commit

5383a0591f22b9640a570e299a73706eb4a27ffcIvan MolodetskikhParent: 0c68609
src/layout/closing_window.rsmodified+2 -2
@@ -125,7 +125,7 @@ impl ClosingWindow {
125125 }
126126
127127 pub fn are_animations_ongoing(&self) -> bool {
128- !self.anim.is_done()
128+ !self.anim.is_clamped_done()
129129 }
130130
131131 pub fn render(
@@ -134,7 +134,7 @@ impl ClosingWindow {
134134 scale: Scale<f64>,
135135 target: RenderTarget,
136136 ) -> ClosingWindowRenderElement {
137- let val = self.anim.value();
137+ let val = self.anim.clamped_value();
138138
139139 let block_out = match self.block_out_from {
140140 None => false,
src/layout/tile.rsmodified+1 -1
@@ -387,7 +387,7 @@ impl<W: LayoutElement> Tile<W> {
387387 renderer,
388388 scale.x as i32,
389389 &elements,
390- anim.value().clamp(0., 1.) as f32,
390+ anim.clamped_value().clamp(0., 1.) as f32,
391391 );
392392 self.window()
393393 .set_offscreen_element_id(Some(elem.id().clone()));
src/layout/workspace.rsmodified+4 -2
@@ -956,8 +956,10 @@ impl<W: LayoutElement> Workspace<W> {
956956
957957 // FIXME: this is a bit cursed since it's relying on Tile's internal details.
958958 let (starting_alpha, starting_scale) = if let Some(anim) = tile.open_animation() {
959- let val = anim.value();
960- (val.clamp(0., 1.) as f32, (val / 2. + 0.5).max(0.))
959+ (
960+ anim.clamped_value().clamp(0., 1.) as f32,
961+ (anim.value() / 2. + 0.5).max(0.),
962+ )
961963 } else {
962964 (1., 1.)
963965 };
src/ui/config_error_notification.rsmodified+1 -3
@@ -119,9 +119,7 @@ impl ConfigErrorNotification {
119119 }
120120 State::Hiding(anim) => {
121121 anim.set_current_time(target_presentation_time);
122- // HACK: prevent bounciness on hiding. This is better done with a clamp property on
123- // the spring animation.
124- if anim.is_done() || anim.value() <= 0. {
122+ if anim.is_clamped_done() {
125123 self.state = State::Hidden;
126124 }
127125 }