|
Hi, I want to change parameter of the animation while the animation is running. But if I change the parameter, the change is ignored until the animation stopped. The goal with this UI:
Whats wrong? What do I need to change change to reach the goal? thank you for your ideas & help. Here is the source:
|
|
Hi, If you want the square to move back to the starting position you need to change the offset again, so in the stop button action you need to set isAnimatting to false. |
|
Hi, I dont want it back tothe start point. This is not the problem. I want the blue rectangle to reach the endpoint immediately after clicking 'stop'. If you dont click 'stop' it needs 5 sec to reach the endpoint. Thats okay. But if I click 'stop' one or two seconds after the start, it has to reach the endpoint immediately. The oscillation has to stop. |
|
If you read the documentation for I have made some modifications to your code to help illustrate this. You want I don't think that it is possible achieve what you want using Add these changes to illustrate the animations. New @State variable
Change to the Rectangle
Changes to he HStack Buttons
|
|
Hi, youre right, there is no official way to do this. I used a trick to get it solved: Manual fire the trigger for the next animation in the event of button-press. Thanks for the help. Ciao |
BUILD THE ULTIMATE PORTFOLIO APP Most Swift tutorials help you solve one specific problem, but in my Ultimate Portfolio App series I show you how to get all the best practices into a single app: architecture, testing, performance, accessibility, localization, project organization, and so much more, all while building a SwiftUI app that works on iOS, macOS and watchOS.
Sponsor Hacking with Swift and reach the world's largest Swift community!
This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.
All interactions here are governed by our code of conduct.
Link copied to your pasteboard.