Skip to content

Instantly share code, notes, and snippets.

@amosgyamfi
Created November 27, 2024 01:42
Show Gist options
  • Save amosgyamfi/78ed55cca88ae6381f79ea7b671f3b1e to your computer and use it in GitHub Desktop.
Save amosgyamfi/78ed55cca88ae6381f79ea7b671f3b1e to your computer and use it in GitHub Desktop.
import SwiftUI
struct ChangeSize: View {
var body: some View {
// Use PhaseAnimator to continuously animate between two scale values
PhaseAnimator([1.0, 0.5]) { scale in
Circle()
.fill(Color.blue)
.frame(width: 80, height: 80)
.scaleEffect(scale)
} animation: { _ in
.spring(duration: 1, bounce: 0.3)
}
}
}
#Preview {
ChangeSize()
}
// End of file. No additional code.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment