forked from PistonDevelopers/conrod
/
materials.rs
85 lines (80 loc) · 2.8 KB
/
materials.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
use carbide_core::draw::{Color, Dimension};
use carbide_core::environment::*;
use carbide_core::widget::*;
use carbide_wgpu::{Application, Window};
fn main() {
let mut application = Application::new();
let background = HStack::new((
Rectangle::new()
.fill(Color::new_rgb(251, 61, 56))
.frame(200.0, 800.0),
Rectangle::new()
.fill(Color::new_rgb(253, 148, 38))
.frame(80.0, 800.0),
Rectangle::new()
.fill(Color::new_rgb(254, 203, 47))
.frame(80.0, 800.0),
Rectangle::new()
.fill(Color::new_rgb(61, 198, 95))
.frame(80.0, 800.0),
Rectangle::new()
.fill(Color::new_rgb(21, 126, 251))
.frame(80.0, 800.0),
Rectangle::new()
.fill(Color::new_rgb(174, 89, 219))
.frame(80.0, 800.0),
Rectangle::new()
.fill(Color::new_rgb(251, 61, 56))
.frame(200.0, 800.0),
))
.spacing(0.0)
.rotation_effect(45.0);
let materials = ZStack::new((
background,
VStack::new((
HStack::new((
Rectangle::new()
.material(EnvironmentColor::UltraThickLight)
.frame(100.0, 100.0),
Rectangle::new()
.material(EnvironmentColor::ThickLight)
.frame(100.0, 100.0),
Rectangle::new()
.material(EnvironmentColor::RegularLight)
.frame(100.0, 100.0),
Rectangle::new()
.material(EnvironmentColor::ThinLight)
.frame(100.0, 100.0),
Rectangle::new()
.material(EnvironmentColor::UltraThinLight)
.frame(100.0, 100.0),
))
.spacing(10.0),
HStack::new((
Rectangle::new()
.material(EnvironmentColor::UltraThickDark)
.frame(100.0, 100.0),
Rectangle::new()
.material(EnvironmentColor::ThickDark)
.frame(100.0, 100.0),
Rectangle::new()
.material(EnvironmentColor::RegularDark)
.frame(100.0, 100.0),
Rectangle::new()
.material(EnvironmentColor::ThinDark)
.frame(100.0, 100.0),
Rectangle::new()
.material(EnvironmentColor::UltraThinDark)
.frame(100.0, 100.0),
))
.spacing(10.0),
))
.spacing(10.0),
));
application.set_scene(Window::new(
"Materials example",
Dimension::new(600.0, 450.0),
materials
).close_application_on_window_close());
application.launch();
}