Comments (4)
Thanks for filling a bug.
The thing is that the binding evaluation is lazy, and the animation starts from the last evaluated value.
So in summary, the binding for your property is (pseudo-code):
y: !self.expanded ? self.start-y : 'state-animation-to'(0);
when you change the value of start-y, the value of y
is marked as dirty but not re-evaluated yet.
If you don't query the value before changing the state, the state animation will start at the last computed value of the property.
You found the work around which is to query that property before the animation start.
One change we could do is re-evaluate the property of the previous state before as the start of the animation. But that also might not be correct :-/
Slightly related is #4811 in which animation restarts with an outdated value.
from slint.
Thanks for your reply!
One change we could do is re-evaluate the property of the previous state before as the start of the animation. But that also might not be correct :-/
This is precisely what I would expect. Could you elaborate on why you think it might not be correct? I can't think of any example. If the property is already marked dirty when the transition starts, it was changed before the transition was triggered. In my opinion, the order here implies that the transition should use the updated value.
When I access (query) the value, it gets updated. But the animation also (well, conceptually) queries the value to know what to start from. So, the behavior should be the same.
Am I missing something? 😉
from slint.
The case i'm thinking about is this:
states [
A when ...: { p: 0; in => { animate p { duration 1s } }
B when ...: { p: 100; in => { animate p { duration 1s } }
]
- state A is active,
p
is 0. - state B becomes active,
p
is set to animate from 0 to 100 in 1s. animations start - after 0.5s, state A becomes active again and want to set the property back to 0.
When we change back from B to A, the property p
is dirty because the time changes. But we don't want to re-evaluate the start position of state B either.
from slint.
I might be missing or misunderstanding something, and I don't know the implementation details.
But:
When we change back from B to A, the property p is dirty because the time changes.
The p
property is dirty because it was updated by the B-state transition (which seems good). When we switch back to state A, we should use the latest property value as a start position (right?). So, the dirty state should be taken into consideration, and the property value should be evaluated before the A-state transition starts.
But we don't want to re-evaluate the start position of state B either.
Why do we consider B at all? Shouldn't the B-state animation just stop (be aborted) when we switch back to state A?
from slint.
Related Issues (20)
- Panic in slint compiler: The remove return pass should have removed all return HOT 2
- Showing two windows at once on Winit/Skia on Wayland/GNOME causes one to be incorrectly painted initially
- When opening multiple windows on Wayland/Winit, it's not possible to close them separately HOT 1
- `LineEdit`: Can not select text with the mouse HOT 1
- Can't bring global to Rust scope HOT 2
- LinuxKMS: Finish linux framebuffer support
- The button component cannot be displayed in Chinese HOT 4
- Small proposal, hope Slint gets better and better HOT 1
- random svg path preview HOT 3
- (Question) Does the program executable is standalone?
- Multiple component in the interpreter HOT 2
- Document global behavior with several instance of components.
- LLR-based interpreter
- Python: Make `__str__` work for `CompileError`'s `diagnostics` field HOT 2
- The ScrollView has a high CPU load when the scrollbar appears HOT 9
- Chinese characters don't display correctly in some condition. HOT 1
- python's test_timer flacky HOT 1
- The ListView's viewport-width is not working and no horizontal bar HOT 2
- Setting the size of Window on start up does not "stick" HOT 5
- Too many non-local `impl` definition for sp :: FieldOffsets in rust nightly 1.81 HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from slint.