Skip to content

Commit

Permalink
Improved Shake animation
Browse files Browse the repository at this point in the history
  • Loading branch information
Dean151 committed Mar 23, 2024
1 parent fd2df72 commit b16ada4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Sources/ButtonKit/ThrowableStyle/ThrowableStyle+Shake.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public struct ShakeThrowableButtonStyle: ThrowableButtonStyle {
public func makeButton(configuration: ButtonConfiguration) -> some View {
configuration.button
.modifier(Shake(animatableData: CGFloat(configuration.errorCount)))
.animation(.default, value: configuration.errorCount)
.animation(.easeInOut, value: configuration.errorCount)
}
}

Expand All @@ -45,7 +45,7 @@ extension ThrowableButtonStyle where Self == ShakeThrowableButtonStyle {

struct Shake: GeometryEffect {
var amount: CGFloat = 10
var shakesPerUnit = 3
var shakesPerUnit = 4
var animatableData: CGFloat

func effectValue(size: CGSize) -> ProjectionTransform {
Expand Down

0 comments on commit b16ada4

Please sign in to comment.