Created
May 28, 2020 03:15
-
-
Save karthironald/733177e139ce91bc719509584f085234 to your computer and use it in GitHub Desktop.
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 characters
struct ContentView: View { | |
@State private var shouldAnimate = false | |
var body: some View { | |
HStack(alignment: .center, spacing: shouldAnimate ? 15 : 5) { | |
Capsule(style: .continuous) | |
.fill(Color.blue) | |
.frame(width: 10, height: 50) | |
Capsule(style: .continuous) | |
.fill(Color.blue) | |
.frame(width: 10, height: 30) | |
Capsule(style: .continuous) | |
.fill(Color.blue) | |
.frame(width: 10, height: 50) | |
Capsule(style: .continuous) | |
.fill(Color.blue) | |
.frame(width: 10, height: 30) | |
Capsule(style: .continuous) | |
.fill(Color.blue) | |
.frame(width: 10, height: 50) | |
} | |
.frame(width: shouldAnimate ? 150 : 100) | |
.animation(Animation.easeInOut(duration: 1).repeatForever(autoreverses: true)) | |
.onAppear { | |
self.shouldAnimate = true | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment