diff options
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/clock/src/main.rs | 2 | ||||
| -rw-r--r-- | examples/modern_art/src/main.rs | 21 | ||||
| -rw-r--r-- | examples/solar_system/src/main.rs | 14 | 
3 files changed, 15 insertions, 22 deletions
| diff --git a/examples/clock/src/main.rs b/examples/clock/src/main.rs index be614201..a389c54f 100644 --- a/examples/clock/src/main.rs +++ b/examples/clock/src/main.rs @@ -1,6 +1,6 @@  use iced::executor;  use iced::widget::canvas::{ -    Cache, Cursor, Geometry, LineCap, Path, Stroke, stroke, +    stroke, Cache, Cursor, Geometry, LineCap, Path, Stroke,  };  use iced::widget::{canvas, container};  use iced::{ 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 diff --git a/examples/solar_system/src/main.rs b/examples/solar_system/src/main.rs index b638c6d0..09ac508d 100644 --- a/examples/solar_system/src/main.rs +++ b/examples/solar_system/src/main.rs @@ -11,7 +11,9 @@ use iced::executor;  use iced::theme::{self, Theme};  use iced::time;  use iced::widget::canvas; -use iced::widget::canvas::{Cursor, Path, Stroke, Gradient, stroke, gradient::Position}; +use iced::widget::canvas::{ +    gradient::Position, stroke, Cursor, Gradient, Path, Stroke, +};  use iced::window;  use iced::{      Application, Color, Command, Element, Length, Point, Rectangle, Settings, @@ -201,12 +203,10 @@ impl<Message> canvas::Program<Message> for State {                  let earth = Path::circle(Point::ORIGIN, Self::EARTH_RADIUS); -                let earth_fill = Gradient::linear( -                    Position::Absolute { -                        start: Point::new(-Self::EARTH_RADIUS, 0.0), -                        end: Point::new(Self::EARTH_RADIUS, 0.0) -                    } -                ) +                let earth_fill = Gradient::linear(Position::Absolute { +                    start: Point::new(-Self::EARTH_RADIUS, 0.0), +                    end: Point::new(Self::EARTH_RADIUS, 0.0), +                })                  .add_stop(0.2, Color::from_rgb(0.15, 0.50, 1.0))                  .add_stop(0.8, Color::from_rgb(0.0, 0.20, 0.47))                  .build() | 
