summaryrefslogtreecommitdiffstats
path: root/examples/arc/src/main.rs
diff options
context:
space:
mode:
authorLibravatar shan <shankern@protonmail.com>2022-09-29 10:52:58 -0700
committerLibravatar shan <shankern@protonmail.com>2022-09-29 10:52:58 -0700
commit00a8a167122301983753a2f4b43d136c79a7d5cb (patch)
tree99596e40da4150eab2d9e862d84373fcf02a548d /examples/arc/src/main.rs
parent97f385e093711c269df315b28f76e66e0220e22a (diff)
downloadiced-00a8a167122301983753a2f4b43d136c79a7d5cb.tar.gz
iced-00a8a167122301983753a2f4b43d136c79a7d5cb.tar.bz2
iced-00a8a167122301983753a2f4b43d136c79a7d5cb.zip
Adds linear gradient support to 2D meshes in the canvas widget.
Diffstat (limited to '')
-rw-r--r--examples/arc/src/main.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/examples/arc/src/main.rs b/examples/arc/src/main.rs
index 0c619dc9..6029a69c 100644
--- a/examples/arc/src/main.rs
+++ b/examples/arc/src/main.rs
@@ -2,7 +2,7 @@ use std::{f32::consts::PI, time::Instant};
use iced::executor;
use iced::widget::canvas::{
- self, Cache, Canvas, Cursor, Geometry, Path, Stroke,
+ self, Cache, Canvas, Cursor, Geometry, Path, Stroke, StrokeStyle,
};
use iced::{
Application, Command, Element, Length, Point, Rectangle, Settings,
@@ -52,11 +52,6 @@ impl Application for Arc {
Command::none()
}
- fn subscription(&self) -> Subscription<Message> {
- iced::time::every(std::time::Duration::from_millis(10))
- .map(|_| Message::Tick)
- }
-
fn view(&self) -> Element<Message> {
Canvas::new(self)
.width(Length::Fill)
@@ -67,6 +62,11 @@ impl Application for Arc {
fn theme(&self) -> Theme {
Theme::Dark
}
+
+ fn subscription(&self) -> Subscription<Message> {
+ iced::time::every(std::time::Duration::from_millis(10))
+ .map(|_| Message::Tick)
+ }
}
impl<Message> canvas::Program<Message> for Arc {
@@ -114,7 +114,7 @@ impl<Message> canvas::Program<Message> for Arc {
frame.stroke(
&path,
Stroke {
- color: palette.text,
+ style: StrokeStyle::Solid(palette.text),
width: 10.0,
..Stroke::default()
},