animate background
not triggering as expected
#4807
-
Consider the following fragment: export component MainWindow inherits Window {
private property <duration> duration: 1s;
private property <[color]> colors: [#f00, #0f0, #00f];
private property <int> tick: animation-tick() / duration;
private property <int> color-index: mod(tick, colors.length);
width: 400px;
height: 300px;
background: colors[color-index];
animate background { duration: self.duration; }
} The behaviour I expect is that over a 3s period, the window will cycle smoothly between red, green, and blue, then repeat. On v1.4.1 (VSCode extension + SlintPad), the window instead remains at one of the colours, and will not change. If I tack on something like... TouchArea {
pointer-event(e) => {
if (e.kind == PointerEventKind.up) { parent.tick += 1; }
}
} ...then once I click the area, the |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
Hmm, I have an answer but it leads to another question. I took my original fragment, and added a |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
I have seen this problem before, but there was not yet an open bug about it so i opened #4811 The problem is that because of animation-tick, the property is always marked as dirty and the animation is constantly restarted without having the ability to do any progress. |
Beta Was this translation helpful? Give feedback.
I have seen this problem before, but there was not yet an open bug about it so i opened #4811
The problem is that because of animation-tick, the property is always marked as dirty and the animation is constantly restarted without having the ability to do any progress.