forge
Explore
Log in

Don't you dare go Hollow

tile: Prepare for oscillating animations

Browse files at this commit

8bebd54c6d63e3e500399f9737a0906de30dfbbeIvan MolodetskikhParent: 1978e5b
src/layout/tile.rsmodified+4 -3
@@ -198,7 +198,8 @@ impl<W: LayoutElement> Tile<W> {
198 .open_animation198 .open_animation
199 .as_ref()199 .as_ref()
200 .map(|anim| anim.value())200 .map(|anim| anim.value())
201- .unwrap_or(1.);201+ .unwrap_or(1.)
202+ .max(0.);
202 Size::from(((f64::from(size.w) * v).round() as i32, size.h))203 Size::from(((f64::from(size.w) * v).round() as i32, size.h))
203 }204 }
204 205
@@ -356,7 +357,7 @@ impl<W: LayoutElement> Tile<W> {
356 renderer,357 renderer,
357 scale.x as i32,358 scale.x as i32,
358 &elements,359 &elements,
359- anim.value() as f32,360+ anim.value().clamp(0., 1.) as f32,
360 );361 );
361 self.window()362 self.window()
362 .set_offscreen_element_id(Some(elem.id().clone()));363 .set_offscreen_element_id(Some(elem.id().clone()));
@@ -369,7 +370,7 @@ impl<W: LayoutElement> Tile<W> {
369 RescaleRenderElement::from_element(370 RescaleRenderElement::from_element(
370 elem,371 elem,
371 center.to_physical_precise_round(scale),372 center.to_physical_precise_round(scale),
372- (anim.value() / 2. + 0.5).min(1.),373+ (anim.value() / 2. + 0.5).max(0.),
373 ),374 ),
374 ))375 ))
375 .into_iter()376 .into_iter()