Skip to content

Instantly share code, notes, and snippets.

@jacobsapps
Created August 9, 2025 13:19
Show Gist options
  • Save jacobsapps/521a1671609cefa7ae60d5a8c441e1e1 to your computer and use it in GitHub Desktop.
Save jacobsapps/521a1671609cefa7ae60d5a8c441e1e1 to your computer and use it in GitHub Desktop.
struct WeightlifterKeyframes {
var verticalScale: Double = 1.0
var verticalOffset: Double = 0.0
}
private var weightlifterAnimation: some View {
Image(systemName: "figure.strengthtraining.traditional")
.resizable()
.foregroundStyle(.white)
.frame(width: 200, height: 200)
.keyframeAnimator(
initialValue: WeightlifterKeyframes(),
repeating: true
) { view, keyframes in
view
.scaleEffect(y: keyframes.verticalScale, anchor: .bottom)
.offset(y: keyframes.verticalOffset)
} keyframes: { _ in
KeyframeTrack(\.verticalScale) {
LinearKeyframe(0.5, duration: 0.25)
LinearKeyframe(1.0, duration: 0.25)
LinearKeyframe(1.3, duration: 0.25)
LinearKeyframe(1.0, duration: 0.25)
}
KeyframeTrack(\.verticalOffset) {
LinearKeyframe(20, duration: 0.25)
SpringKeyframe(-40, duration: 0.5, spring: .snappy)
CubicKeyframe(0, duration: 0.25)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment