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
struct DeepConcaveView : View { | |
let cornerRadius : CGFloat | |
var body: some View { | |
ZStack { | |
RoundedRectangle(cornerRadius: cornerRadius) | |
.fill(Color(Colors.mainColor)) | |
RoundedRectangle(cornerRadius: cornerRadius) | |
.stroke(Color(Colors.darkShadow), lineWidth: 2) | |
.blur(radius: 0.5) |
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
struct ShallowConcaveView : View { | |
let cornerRadius : CGFloat | |
var body: some View { | |
ZStack { | |
RoundedRectangle(cornerRadius: cornerRadius) | |
.fill(Color(Colors.mainColor)) | |
RoundedRectangle(cornerRadius: cornerRadius) | |
.stroke(Color(Colors.darkShadow), lineWidth: 2) | |
.blur(radius: 0.5) |
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
struct ContentView: View { | |
@State var likes :[LikeView] = [] | |
func likeAction () { | |
likes += [LikeView()] | |
} | |
var body: some View { | |
ZStack { | |
Color.black.ignoresSafeArea() |
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
struct ContentView: View { | |
@State var likes = 0 | |
func likeAction () { | |
likes += 1 | |
} | |
var body: some View { | |
ZStack { | |
Color.black.ignoresSafeArea() |
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
struct LikesModifier: ViewModifier { | |
@State var time = 0.0 | |
let duration = 1.0 | |
func body(content: Content) -> some View { | |
ZStack { | |
ForEach(0..<2) { _ in | |
content | |
.foregroundColor(.white) | |
.modifier(LikesGeometryEffect(time: time)) |
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
struct LikesGeometryEffect : GeometryEffect { | |
var time : Double | |
var speed = Double.random(in: 100 ... 200) | |
var xDirection = Double.random(in: -0.05 ... 0.05) | |
var yDirection = Double.random(in: -Double.pi ... 0) | |
var animatableData: Double { | |
get { time } | |
set { time = newValue } | |
} |
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
struct LikeTapModifier: ViewModifier { | |
@State var time = 0.0 | |
let duration = 1.0 | |
func body(content: Content) -> some View { | |
ZStack { | |
content | |
.foregroundColor(.red) | |
.modifier(LikesGeometryEffect(time: time)) | |
.opacity(time == 1 ? 0 : 1) |
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
struct ContentView: View { | |
var body: some View { | |
VStack { | |
ScrollView { | |
ZStack { | |
Rectangle().fill(.orange.opacity(0.4)).frame(height: 800) | |
Text("Animation").font(.system(size: 50)).padding(.bottom, 80) | |
Text("inside a scrollview").font(.title) | |
} | |
animatedView() |
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
struct AnimatedBox: View { | |
@State var val1 = 0.0 | |
@State var val2 = 0.0 | |
@State var val3 = 0.5 | |
@State var val4 = 0.5 | |
@State var scale = 0.5 | |
@State var opacity = 0.0 |
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
struct AnimatedCircle: View { | |
@State var val = 0.0 | |
@State var scale = 0.2 | |
var body: some View { | |
ZStack { | |
Circle() | |
.stroke(.black.opacity(0.07),lineWidth: 23) | |
.frame(width: 220, height: 220) | |