Add a Sun disc to the dial

It rises on the horizon ^_^
This commit is contained in:
Gergely Polonkai 2022-05-18 17:10:55 +02:00
parent 534bf3a899
commit a613855a66
No known key found for this signature in database
GPG Key ID: 2D2885533B869ED4

View File

@ -216,6 +216,7 @@ fn gen_svg() -> Document {
.day-time {stroke: none; fill: rgb(125, 197, 240);}
.moon-background {stroke: rgb(170, 170, 170); stroke-width: 2px; fill: rgb(19, 17, 30);}
.moon {stroke: none; fill: rgb(170, 170, 170);}
.sun {stroke: none; fill: rgb(238, 187, 85);}
.mid-marker {stroke: red;}
.dial {stroke-width: 2px; stroke: rgb(238, 187, 85);}",
);
@ -277,6 +278,21 @@ fn gen_svg() -> Document {
evening_golden_start,
);
let sun_disc = Circle::new()
.set("class", "sun")
.set("cx", image_width / 2)
.set("cy", image_width as f32 / 2.0 + outer_r / 2.0 + sun_radius)
.set("r", sun_radius)
.set(
"transform",
format!(
"rotate({}, {}, {})",
time_to_degrees(local_time),
image_width / 2,
image_width / 2
),
);
let blue_hour_path = get_range_path(
image_width,
marker_radius,
@ -291,6 +307,7 @@ fn gen_svg() -> Document {
.set("id", "day-parts")
.add(daytime_circle)
.add(golden_hour_path)
.add(sun_disc)
.add(blue_hour_path)
.add(nighttime_path);