Skip to content

Commit

Permalink
improve moonrise/set icon
Browse files Browse the repository at this point in the history
  • Loading branch information
LEOYoon-Tsaw committed May 26, 2023
1 parent 49a7747 commit 5fe19a3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions WatchWidget/IconView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ struct MoonPhase: View {
moonContext.clip(to: Path(groundMaskPath), options: .inverse)
moonContext.translateBy(x: 0, y: minEdge * 0.10)
}
var backContext = moonContext

let width = centerRadius * (1.0 + cos(4.0 * CGFloat.pi * angle)) / 2.0
let ellipse = CGMutablePath(ellipseIn: CGRect(x: center.x - width, y: center.y - centerRadius, width: width * 2, height: centerRadius * 2), transform: nil)
Expand All @@ -135,8 +136,8 @@ struct MoonPhase: View {
halfMoon.closeSubpath()
moonContext.fill(Path(halfMoon), with: .color(Color(cgColor: color)))

let circle = CGMutablePath(ellipseIn: CGRect(x: center.x - centerRadius + minEdge * 0.01, y: center.y - centerRadius + minEdge * 0.01, width: centerRadius * 2 - minEdge * 0.02, height: centerRadius * 2 - minEdge * 0.02), transform: nil)
moonContext.stroke(Path(circle), with: .color(Color(cgColor: color)), style: StrokeStyle(lineWidth: minEdge * 0.02, lineCap: .round, dash: [minEdge * 0.04, minEdge * 0.07]))
let circle = CGMutablePath(ellipseIn: CGRect(x: center.x - centerRadius, y: center.y - centerRadius, width: centerRadius * 2, height: centerRadius * 2), transform: nil)
backContext.fill(Path(circle), with: .color(Color(cgColor: color).opacity(0.2 * color.alpha)))

for position in [0.2, 0.4, 0.76] {
let direction = pointOnCircle(center: center, radius: ringRadius, angle: (position + angle * 0.02) * CGFloat.pi * 2.0)
Expand Down

0 comments on commit 5fe19a3

Please sign in to comment.