Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spring animation (or any other) won't start after setting target. #48

Open
TomerAvni opened this issue Jul 22, 2020 · 0 comments
Open

Comments

@TomerAvni
Copy link

HI,
I've been trying for hours to make the animation start, but couldn't. The onChange method, never gets called.
This is the code:

let spring = Spring(initialValue: 0)
spring.onChange = { [weak view] val in
          print("change!") // never gets called.
          view?.frame.origin.y = val
}

spring.target = 500

I've tried debugging the whole thing and the simulation function never turns into .animating (state). I can't figure this out.
Tried calling both view.setNeedsLayout() and view.setNeedsDisplay().

What am I missing?
Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant