From 40f45d7b7e35dd4937abe6b5ce16b6256b4f1eeb Mon Sep 17 00:00:00 2001 From: shan Date: Thu, 29 Sep 2022 10:52:58 -0700 Subject: Adds linear gradient support to 2D meshes in the canvas widget. --- examples/solar_system/src/main.rs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'examples/solar_system') diff --git a/examples/solar_system/src/main.rs b/examples/solar_system/src/main.rs index c59d73a8..fcd20561 100644 --- a/examples/solar_system/src/main.rs +++ b/examples/solar_system/src/main.rs @@ -19,6 +19,7 @@ use iced::{ }; use std::time::Instant; +use crate::canvas::StrokeStyle; pub fn main() -> iced::Result { SolarSystem::run(Settings { @@ -37,9 +38,9 @@ enum Message { } impl Application for SolarSystem { + type Executor = executor::Default; type Message = Message; type Theme = Theme; - type Executor = executor::Default; type Flags = (); fn new(_flags: ()) -> (Self, Command) { @@ -65,10 +66,6 @@ impl Application for SolarSystem { Command::none() } - fn subscription(&self) -> Subscription { - time::every(std::time::Duration::from_millis(10)).map(Message::Tick) - } - fn view(&self) -> Element { canvas(&self.state) .width(Length::Fill) @@ -86,6 +83,10 @@ impl Application for SolarSystem { text_color: Color::WHITE, }) } + + fn subscription(&self) -> Subscription { + time::every(std::time::Duration::from_millis(10)).map(Message::Tick) + } } #[derive(Debug)] @@ -178,8 +179,8 @@ impl canvas::Program for State { frame.stroke( &orbit, Stroke { + style: StrokeStyle::Solid(Color::from_rgba8(0, 153, 255, 0.1)), width: 1.0, - color: Color::from_rgba8(0, 153, 255, 0.1), line_dash: canvas::LineDash { offset: 0, segments: &[3.0, 6.0], -- cgit