summaryrefslogtreecommitdiffstats
path: root/examples/solar_system/src/main.rs
diff options
context:
space:
mode:
authorLibravatar shan <shankern@protonmail.com>2022-10-07 11:41:50 -0700
committerLibravatar shan <shankern@protonmail.com>2022-10-07 12:01:07 -0700
commit12a87c54eb68b992676060c80e518ffb29445cfc (patch)
treeb3fba16f2dd95a084cdbc3850f59a049c103c355 /examples/solar_system/src/main.rs
parentf9a6efcaa03728f43aaa105af8936c1ed4778388 (diff)
downloadiced-12a87c54eb68b992676060c80e518ffb29445cfc.tar.gz
iced-12a87c54eb68b992676060c80e518ffb29445cfc.tar.bz2
iced-12a87c54eb68b992676060c80e518ffb29445cfc.zip
Added support for relative positioning of gradient fills. Addressed some PR feedback.
Diffstat (limited to 'examples/solar_system/src/main.rs')
-rw-r--r--examples/solar_system/src/main.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/examples/solar_system/src/main.rs b/examples/solar_system/src/main.rs
index 6f38f480..9200391b 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::Position;
pub fn main() -> iced::Result {
SolarSystem::run(Settings {
@@ -202,8 +203,10 @@ impl<Message> canvas::Program<Message> for State {
let earth = Path::circle(Point::ORIGIN, Self::EARTH_RADIUS);
let earth_fill = Gradient::linear(
- Point::new(-Self::EARTH_RADIUS, 0.0),
- Point::new(Self::EARTH_RADIUS, 0.0),
+ 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))