Make Reveal animation less abrupt + prettier separator rounding
This commit is contained in:
parent
f7c2a24572
commit
9f52ff584f
|
@ -424,7 +424,7 @@ impl<T: Widget> Widget for Offset<T> {
|
|||
pub struct Reveal<T> {
|
||||
inner: T,
|
||||
slide_anim: Animation<EaseIn>,
|
||||
opacity_anim: Animation<EaseOut>,
|
||||
opacity_anim: Animation<Linear>,
|
||||
state: bool,
|
||||
}
|
||||
|
||||
|
@ -433,7 +433,7 @@ impl<T: Widget> Reveal<T> {
|
|||
Self {
|
||||
inner,
|
||||
slide_anim: Animation::new(EaseIn, duration, slide, 0.0),
|
||||
opacity_anim: Animation::new(EaseOut, duration, 0.0, 1.0),
|
||||
opacity_anim: Animation::new(Linear, duration, 0.0, 1.0),
|
||||
state: false,
|
||||
}
|
||||
}
|
||||
|
@ -553,6 +553,7 @@ impl TabMenu {
|
|||
const TAB_HEIGHT: f32 = 0.06;
|
||||
const TAB_NUM: usize = 6;
|
||||
const SEPARATOR_WIDTH: f32 = 0.015;
|
||||
const INNER_RADIUS: f32 = 0.005;
|
||||
const BOX_SIZE: f32 = 0.05;
|
||||
const BOX_MARGIN: f32 = 0.01;
|
||||
const BOX_PADDING: f32 = 0.005;
|
||||
|
@ -601,11 +602,8 @@ impl Widget for TabMenu {
|
|||
|
||||
// alignment variables
|
||||
let tab_list_height = Self::TAB_NUM as f32 * Self::TAB_HEIGHT;
|
||||
let separator_xy = Vec2::new(Self::TAB_WIDTH, Self::SEPARATOR_WIDTH - tab_list_height);
|
||||
let separator_size = Vec2::new(
|
||||
Self::SEPARATOR_WIDTH,
|
||||
tab_list_height - Self::SEPARATOR_WIDTH,
|
||||
);
|
||||
let separator_xy = Vec2::new(Self::TAB_WIDTH, -tab_list_height);
|
||||
let separator_size = Vec2::new(Self::SEPARATOR_WIDTH, tab_list_height);
|
||||
let body_width = Self::BOX_GRID_WIDTH as f32 * (Self::BOX_SIZE + Self::BOX_PADDING)
|
||||
+ Self::BOX_MARGIN * 2.0;
|
||||
let body_height = tab_list_height - Self::BOX_MARGIN * 2.0;
|
||||
|
@ -618,11 +616,11 @@ impl Widget for TabMenu {
|
|||
let head_tr_xy = head_tl_xy + Vec2::new(head_edge_size.x, 0.0);
|
||||
|
||||
// draw shapes
|
||||
ctx.draw_rect(separator_xy, separator_size, head_color);
|
||||
ctx.draw_quarter_circle(
|
||||
Corner::BottomRight,
|
||||
ctx.draw_partially_rounded_rect(
|
||||
CornerFlags::BOTTOM_RIGHT,
|
||||
separator_xy,
|
||||
Self::SEPARATOR_WIDTH,
|
||||
separator_size,
|
||||
Self::INNER_RADIUS,
|
||||
head_color,
|
||||
);
|
||||
|
||||
|
|
Loading…
Reference in New Issue