-
-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Release V1: Add system-wide media playing support and new animations
""" - Added support for all sorts of media playing system-wide. - Improved animations for a smoother user experience. - Introduced new states for better functionality. - Added a happy face animation to make the notch more fun. """
- Loading branch information
1 parent
1fc7872
commit 6646ce9
Showing
16 changed files
with
534 additions
and
190 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>NSAppleEventsUsageDescription</key> | ||
<string>Read current playing music from system events</string> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// | ||
// drop.swift | ||
// boringNotch | ||
// | ||
// Created by Harsh Vardhan Goswami on 04/08/24. | ||
// | ||
|
||
import Foundation | ||
import SwiftUI | ||
|
||
|
||
public class BoringAnimations { | ||
@Published var notchStyle: Style = .notch | ||
|
||
init() { | ||
self.notchStyle = .notch | ||
} | ||
|
||
var animation: Animation { | ||
if #available(macOS 14.0, *), notchStyle == .notch { | ||
Animation.spring(.bouncy(duration: 0.4)) | ||
} else { | ||
Animation.timingCurve(0.16, 1, 0.3, 1, duration: 0.7) | ||
} | ||
} | ||
|
||
// TODO: Move all animations to this file | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
// | ||
// AnimatedFace.swift | ||
// | ||
// Created by Harsh Vardhan Goswami on 04/08/24. | ||
// | ||
|
||
import SwiftUI | ||
|
||
struct MinimalFaceFeatures: View { | ||
@State private var isBlinking = false | ||
@State var height:CGFloat = 20; | ||
@State var width:CGFloat = 30; | ||
|
||
var body: some View { | ||
VStack(spacing: 4) { // Adjusted spacing to fit within 30x30 | ||
// Eyes | ||
HStack(spacing: 4) { // Adjusted spacing to fit within 30x30 | ||
Eye(isBlinking: $isBlinking) | ||
Eye(isBlinking: $isBlinking) | ||
} | ||
|
||
// Nose and mouth combined | ||
VStack(spacing: 2) { // Adjusted spacing to fit within 30x30 | ||
// Nose | ||
RoundedRectangle(cornerRadius: 2) | ||
.fill(Color.white) | ||
.frame(width: 3, height: 10) | ||
|
||
// Mouth (happy) | ||
GeometryReader { geometry in | ||
Path { path in | ||
let width = geometry.size.width | ||
let height = geometry.size.height | ||
path.move(to: CGPoint(x: 0, y: height / 2)) | ||
path.addQuadCurve(to: CGPoint(x: width, y: height / 2), control: CGPoint(x: width / 2, y: height)) | ||
} | ||
.stroke(Color.white, lineWidth: 2) | ||
} | ||
.frame(width: 18, height: 10) | ||
} | ||
} | ||
.frame(width: self.width, height: self.height) // Maximum size of face | ||
.onAppear { | ||
startBlinking() | ||
} | ||
} | ||
|
||
func startBlinking() { | ||
Timer.scheduledTimer(withTimeInterval: 3, repeats: true) { _ in | ||
withAnimation(.easeInOut(duration: 0.1)) { | ||
isBlinking = true | ||
} | ||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) { | ||
withAnimation(.easeInOut(duration: 0.1)) { | ||
isBlinking = false | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
struct Eye: View { | ||
@Binding var isBlinking: Bool | ||
|
||
var body: some View { | ||
RoundedRectangle(cornerRadius: 10) | ||
.fill(Color.white) | ||
.frame(width: 4, height: isBlinking ? 1 : 4) | ||
.frame(maxWidth: 15, maxHeight: 15) // Adjusted max size | ||
.animation(.easeInOut(duration: 0.1), value: isBlinking) | ||
} | ||
} | ||
|
||
struct MinimalFaceFeatures_Previews: PreviewProvider { | ||
static var previews: some View { | ||
ZStack { | ||
Color.black | ||
MinimalFaceFeatures() | ||
} | ||
.previewLayout(.fixed(width: 60, height: 60)) // Adjusted preview size for better visibility | ||
} | ||
} |
Oops, something went wrong.