Last active
July 23, 2024 15:19
-
-
Save kieranb662/c254ec73a6121ce1f88f60e4a1f9a082 to your computer and use it in GitHub Desktop.
Revisions
-
kieranb662 renamed this gist
Jun 29, 2020 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
kieranb662 renamed this gist
Jun 29, 2020 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
kieranb662 revised this gist
Jun 29, 2020 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1 +1 @@  -
kieranb662 revised this gist
Jun 29, 2020 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@  -
kieranb662 revised this gist
Jun 29, 2020 . No changes.There are no files selected for viewing
-
kieranb662 revised this gist
Jun 29, 2020 . No changes.There are no files selected for viewing
-
kieranb662 revised this gist
Apr 27, 2020 . 1 changed file with 4 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,7 @@ // Kieran Brown // Kieran's Components "Pulse and Sheen" // https://kieranb662.github.io/blog/2020/04/17/Pulse-and-Sheen struct PulseEffect<S: Shape>: ViewModifier { var shape: S @State var isOn: Bool = false -
kieranb662 created this gist
Apr 27, 2020 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,33 @@ struct PulseEffect<S: Shape>: ViewModifier { var shape: S @State var isOn: Bool = false var animation: Animation { Animation .easeIn(duration: 1) .repeatCount(8, autoreverses: false) } func body(content: Content) -> some View { content .background( ZStack { shape .stroke(Color.yellow, lineWidth: 1) .scaleEffect(self.isOn ? 2 : 1) .opacity(self.isOn ? 0 : 1) shape .stroke(Color.blue) }) .onAppear { withAnimation(self.animation) { self.isOn = true } } } } public extension View { func pulse<S: Shape>(_ shape: S) -> some View { self.modifier(PulseEffect(shape: shape)) } }