tui_readme.rs 656 B

123456789101112131415161718192021222324252627282930
  1. use dioxus::prelude::*;
  2. fn main() {
  3. dioxus::tui::launch(app);
  4. }
  5. fn app(cx: Scope) -> Element {
  6. let alpha = use_state(&cx, || 100);
  7. cx.render(rsx! {
  8. div {
  9. onwheel: move |evt| alpha.set((**alpha + evt.data.delta_y as i64).min(100).max(0)),
  10. width: "100%",
  11. height: "10px",
  12. background_color: "red",
  13. // justify_content: "center",
  14. // align_items: "center",
  15. p{
  16. color: "rgba(0, 255, 0, {alpha}%)",
  17. "Hello world!"
  18. }
  19. p{
  20. "{alpha}"
  21. }
  22. // p{"Hi"}
  23. }
  24. })
  25. }