I am using Spring library for animation effects in my app.
In my case I have to animate a button on action, So I have added the following code blocks.
override func viewDidLoad() {
super.viewDidLoad()
setOptions()
}
func setOptions() {
testButton.animation = Spring.AnimationPreset.Shake.rawValue
testButton.curve = Spring.AnimationCurve.EaseIn.rawValue
}
@IBAction func testButtonPressed(_ sender: Any) {
animateView()
}
In this above code flow the animation action occurs only one time.
But if I update the "testButtonPressed" method as follows,
@IBAction func testButtonPressed(_ sender: Any) {
setOptions()
animateView()
}
The animation occurs each time I press the testButton.
Why do I have to update the animation property each time ? Isn't it enough to update properties only once ?