summaryrefslogtreecommitdiffstats
path: root/examples/solar_system/src
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón <hector0193@gmail.com>2023-05-19 04:37:58 +0200
committerLibravatar GitHub <noreply@github.com>2023-05-19 04:37:58 +0200
commitcc5d11f1a6fca90ea57e3fb3a69587c65281b6b9 (patch)
tree349d98171b467b7738874a5ef99ce536512c10eb /examples/solar_system/src
parent8e8b1e1eacc4e2c19c9878625f423c8e09e2d3b9 (diff)
parentf7ed645eddd96f7964268367e24abcb5bb78a979 (diff)
downloadiced-cc5d11f1a6fca90ea57e3fb3a69587c65281b6b9.tar.gz
iced-cc5d11f1a6fca90ea57e3fb3a69587c65281b6b9.tar.bz2
iced-cc5d11f1a6fca90ea57e3fb3a69587c65281b6b9.zip
Merge pull request #1846 from bungoboingo/feat/background-gradients
[Feature] Gradients for Backgrounds
Diffstat (limited to 'examples/solar_system/src')
-rw-r--r--examples/solar_system/src/main.rs19
1 files changed, 9 insertions, 10 deletions
diff --git a/examples/solar_system/src/main.rs b/examples/solar_system/src/main.rs
index f2606feb..d9e660d7 100644
--- a/examples/solar_system/src/main.rs
+++ b/examples/solar_system/src/main.rs
@@ -10,7 +10,7 @@ use iced::application;
use iced::executor;
use iced::theme::{self, Theme};
use iced::widget::canvas;
-use iced::widget::canvas::gradient::{self, Gradient};
+use iced::widget::canvas::gradient;
use iced::widget::canvas::stroke::{self, Stroke};
use iced::widget::canvas::{Cursor, Path};
use iced::window;
@@ -22,6 +22,8 @@ use iced::{
use std::time::Instant;
pub fn main() -> iced::Result {
+ env_logger::builder().format_timestamp(None).init();
+
SolarSystem::run(Settings {
antialiasing: true,
..Settings::default()
@@ -208,15 +210,12 @@ impl<Message> canvas::Program<Message> for State {
let earth = Path::circle(Point::ORIGIN, Self::EARTH_RADIUS);
- let earth_fill =
- Gradient::linear(gradient::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()
- .expect("Build Earth fill gradient");
+ let earth_fill = gradient::Linear::new(
+ Point::new(-Self::EARTH_RADIUS, 0.0),
+ 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));
frame.fill(&earth, earth_fill);