summaryrefslogtreecommitdiffstats
path: root/examples/modern_art/src/main.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2022-11-03 04:35:16 +0100
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2022-11-03 04:35:16 +0100
commitb95745340441835bd25b5cadc2342254631f8c05 (patch)
tree38f103e59a9decdc83ac5c7514fe89006bf0c7dd /examples/modern_art/src/main.rs
parent20a0577034b40a6bbabee9bbbfc085f3fd5016c0 (diff)
downloadiced-b95745340441835bd25b5cadc2342254631f8c05.tar.gz
iced-b95745340441835bd25b5cadc2342254631f8c05.tar.bz2
iced-b95745340441835bd25b5cadc2342254631f8c05.zip
Run `cargo fmt`
Diffstat (limited to 'examples/modern_art/src/main.rs')
-rw-r--r--examples/modern_art/src/main.rs21
1 files changed, 7 insertions, 14 deletions
diff --git a/examples/modern_art/src/main.rs b/examples/modern_art/src/main.rs
index fc203cff..db9b0491 100644
--- a/examples/modern_art/src/main.rs
+++ b/examples/modern_art/src/main.rs
@@ -1,9 +1,10 @@
use iced::widget::canvas::{
- self, Cache, Canvas, Cursor, Frame, Geometry, Gradient, gradient::Position, gradient::Location
+ self, gradient::Location, gradient::Position, Cache, Canvas, Cursor, Frame,
+ Geometry, Gradient,
};
use iced::{
executor, Application, Color, Command, Element, Length, Point, Rectangle,
- Renderer, Size, Theme, Settings
+ Renderer, Settings, Size, Theme,
};
use rand::{thread_rng, Rng};
@@ -86,7 +87,7 @@ fn random_direction() -> Location {
5 => Location::Bottom,
6 => Location::BottomLeft,
7 => Location::Left,
- _ => Location::TopLeft
+ _ => Location::TopLeft,
}
}
@@ -106,7 +107,7 @@ fn generate_box(frame: &mut Frame, bounds: Size) -> bool {
top_left,
size,
start: random_direction(),
- end: random_direction()
+ end: random_direction(),
});
let stops = thread_rng().gen_range(1..15u32);
@@ -130,17 +131,9 @@ fn generate_box(frame: &mut Frame, bounds: Size) -> bool {
);
if solid {
- frame.fill_rectangle(
- top_left,
- size,
- random_color(),
- );
+ frame.fill_rectangle(top_left, size, random_color());
} else {
- frame.fill_rectangle(
- top_left,
- size,
- &gradient(top_left, size),
- );
+ frame.fill_rectangle(top_left, size, &gradient(top_left, size));
};
solid