Skip to content

Commit 28f84fe

Browse files
committed
AnimatedPadding example: try to track down the animation problem
Seems that setting the label size makes things better ??? ... Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
1 parent fb08b24 commit 28f84fe

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

examples/animated-padding.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,17 @@ fn build_ui() -> impl Widget<AppState> {
3232
)
3333
.with_child(
3434
AnimatedPadding::new(
35-
Label::new("Animated Padding"),
35+
// Seems setting the text width fixes the animation problem.
36+
Label::new("Animated Padding").fix_width(200.),
37+
// Label::new("Animated Padding"),
3638
|data: &AppState, _env| Insets::uniform(if data.add_space { 30.0 } else { 10.0 }),
37-
).duration(2.0).curve(AnimationCurve::EASE_IN_OUT)
38-
39+
).duration(0.3).curve(AnimationCurve::EASE_IN_OUT)
3940
)
4041
.debug_paint_layout()
4142
}
4243

4344
pub fn main() {
44-
let main_window = WindowDesc::new(build_ui().center())
45+
let main_window = WindowDesc::new(build_ui())
4546
.title("Animated Padding Test");
4647

4748
let state = AppState {

0 commit comments

Comments
 (0)