-
Notifications
You must be signed in to change notification settings - Fork 800
Animate Bindings Reactivity #10387
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
base: master
Are you sure you want to change the base?
Animate Bindings Reactivity #10387
Conversation
| self.animation_data.borrow_mut().reset(); | ||
| let mut animation_data = self.animation_data.borrow_mut(); | ||
| animation_data.reset(); | ||
| if let Some((details, start_time)) = (self.compute_animation_details)() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it might not be good to call something that can query other properties from mark_dirty or we could end up in bad recursion.
Was it a problem to query it on the next frame in ShouldStart as before?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I wanted to discuss this anyhow. This is a quick fix to be able to use current_tick() for an initial test and definitely not optimal. We'll probably want to modify the Animation::Transition type so that we can make the time Option.
Another downside to evaluating the PropertyAnimation inside evaluate is that from a user perspective it becomes very hard to predict when the animation data is computed.
It doesn't happen when the binding to the animated property changes, but rather when the animated property is first read, which could be unintuitive.
@NigelBreslaw agress that the values should remain constant after the animation starts ( #348 (comment) ), but this makes it somewhat hard to determine when exactly "the animation starts".
But maybe documenting this behavior of "the animation data is queried when the property is first read after modification", is probably good enough.
This avoids re-evaluating the PropertyAnimation during the mark_dirty function and re-evaluates it on the first call to evaluate.
This has been replaced by set_animated_binding_for_transition
The `state` variable is referenced by both expressions, so using a single CodeBlock is easier. In the generated code, use tuple destructuring to convert the Instant to an Option<Instant>.
23bd875 to
969095e
Compare
Allow animate properties with a binding to re-query their PropertyAnimation whenever the binding to the property changes.
Closes #348