added alpha channel

This commit is contained in:
Evan Almloff committed 2022-02-17 16:06:28 -06:00
1 parent f6ef9981dd
commit 7a1d8f0532
10 files changed
+821 -277

No files matched your search

+30 -4
View File
@@ -2,9 +2,17 @@ use dioxus::prelude::*;
fn main() {
rink::launch(app);
// rink::launch_cfg(
// app,
// rink::Config {
// rendering_mode: rink::RenderingMode::Ansi,
// },
// )
}
fn app(cx: Scope) -> Element {
let (alpha, set_alpha) = use_state(&cx, || 100);
cx.render(rsx! {
div {
width: "100%",
@@ -13,7 +21,9 @@ fn app(cx: Scope) -> Element {
// justify_content: "center",
// align_items: "center",
// flex_direction: "row",
// background_color: "red",
onwheel: move |evt| {
set_alpha((alpha + evt.data.delta_y as i64).min(100).max(0));
},
p {
background_color: "black",
@@ -21,6 +31,7 @@ fn app(cx: Scope) -> Element {
justify_content: "center",
align_items: "center",
// height: "10%",
color: "green",
"hi"
"hi"
"hi"
@@ -73,7 +84,7 @@ fn app(cx: Scope) -> Element {
div {
font_weight: "bold",
color: "#666666",
p{
p {
"bold"
}
p {
@@ -88,14 +99,29 @@ fn app(cx: Scope) -> Element {
}
p {
text_decoration: "underline",
color: "rgb(50, 100, 255)",
color: "rgba(255, 255, 255)",
"underline"
}
p {
text_decoration: "line-through",
color: "hsl(10, 100%, 70%)",
color: "hsla(10, 100%, 70%)",
"line-through"
}
div{
position: "absolute",
top: "1px",
background_color: "rgba(255, 0, 0, 50%)",
width: "100%",
p {
color: "rgba(255, 255, 255, {alpha}%)",
background_color: "rgba(100, 100, 100, {alpha}%)",
"rgba(255, 255, 255, {alpha}%)"
}
p {
color: "rgba(255, 255, 255, 100%)",
"rgba(255, 255, 255, 100%)"
}
}
}
})
}