Skip to content

Instantly share code, notes, and snippets.

@karthironald
Created May 28, 2020 03:18
Show Gist options
  • Save karthironald/0d2164351cf16f8ebd1b9b22f76c8503 to your computer and use it in GitHub Desktop.
Save karthironald/0d2164351cf16f8ebd1b9b22f76c8503 to your computer and use it in GitHub Desktop.
struct ContentView: View {
@State private var shouldAnimate = false
var body: some View {
HStack {
Circle()
.fill(Color.blue)
.frame(width: 20, height: 20)
.scaleEffect(shouldAnimate ? 1.0 : 0.5)
.animation(Animation.easeInOut(duration: 0.5).repeatForever())
Circle()
.fill(Color.blue)
.frame(width: 20, height: 20)
.scaleEffect(shouldAnimate ? 1.0 : 0.5)
.animation(Animation.easeInOut(duration: 0.5).repeatForever().delay(0.3))
Circle()
.fill(Color.blue)
.frame(width: 20, height: 20)
.scaleEffect(shouldAnimate ? 1.0 : 0.5)
.animation(Animation.easeInOut(duration: 0.5).repeatForever().delay(0.6))
}
.onAppear {
self.shouldAnimate = true
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment