wip: example

This commit is contained in:
Jonathan Kelley committed 2021-07-01 16:03:27 -04:00
1 parent 952a91d540
commit eb39b000d7
3 files changed
+56 -10

No files matched your search

+6 -10
View File
@@ -29,7 +29,7 @@ fn main() {
})
}
// use signals to directly update values outside of the diffing phase
// Animations with signals
fn signal_based(cx: ()) {
const InitPos: (i32, i32) = (0, 0);
const EndPos: (i32, i32) = (100, 200);
@@ -38,16 +38,12 @@ fn signal_based(cx: ()) {
cx.render(rsx! {
div {
style {
style: [
width: spring.0,
width: spring.1
}
button { "Reset"
onclick: move |_| spring.set(InitPos)
}
button { "Animate"
onclick: move |_| spring.set(EndPos)
}
height: spring.1
]
button { onclick: move |_| spring.set(InitPos), "Reset" }
button { onclick: move |_| spring.set(EndPos), "Animate" }
}
})
}