Add a Sun disc to the dial
It rises on the horizon ^_^
This commit is contained in:
		
							
								
								
									
										17
									
								
								src/main.rs
									
									
									
									
									
								
							
							
						
						
									
										17
									
								
								src/main.rs
									
									
									
									
									
								
							@@ -216,6 +216,7 @@ fn gen_svg() -> Document {
 | 
				
			|||||||
        .day-time {stroke: none; fill: rgb(125, 197, 240);}
 | 
					        .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-background {stroke: rgb(170, 170, 170); stroke-width: 2px; fill: rgb(19, 17, 30);}
 | 
				
			||||||
        .moon {stroke: none; fill: rgb(170, 170, 170);}
 | 
					        .moon {stroke: none; fill: rgb(170, 170, 170);}
 | 
				
			||||||
 | 
					        .sun {stroke: none; fill: rgb(238, 187, 85);}
 | 
				
			||||||
        .mid-marker {stroke: red;}
 | 
					        .mid-marker {stroke: red;}
 | 
				
			||||||
        .dial {stroke-width: 2px; stroke: rgb(238, 187, 85);}",
 | 
					        .dial {stroke-width: 2px; stroke: rgb(238, 187, 85);}",
 | 
				
			||||||
    );
 | 
					    );
 | 
				
			||||||
@@ -277,6 +278,21 @@ fn gen_svg() -> Document {
 | 
				
			|||||||
        evening_golden_start,
 | 
					        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(
 | 
					    let blue_hour_path = get_range_path(
 | 
				
			||||||
        image_width,
 | 
					        image_width,
 | 
				
			||||||
        marker_radius,
 | 
					        marker_radius,
 | 
				
			||||||
@@ -291,6 +307,7 @@ fn gen_svg() -> Document {
 | 
				
			|||||||
        .set("id", "day-parts")
 | 
					        .set("id", "day-parts")
 | 
				
			||||||
        .add(daytime_circle)
 | 
					        .add(daytime_circle)
 | 
				
			||||||
        .add(golden_hour_path)
 | 
					        .add(golden_hour_path)
 | 
				
			||||||
 | 
					        .add(sun_disc)
 | 
				
			||||||
        .add(blue_hour_path)
 | 
					        .add(blue_hour_path)
 | 
				
			||||||
        .add(nighttime_path);
 | 
					        .add(nighttime_path);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user