You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When running a KeyFrame animation with FillMode = Forward, the last value that was animated in the animation should be what "holds" when the animation completes. This currently works but ONLY if the last value was set at Cue = 1.0. If the last value was set at any value before that, such as Cue = 0.5, it will not be held after the animation completes.
Avalonia Repro
This sample has 3 rectangles. Red is always visible, while Green and Blue animate to be visible when the button is clicked. When the animation runs, Green fades in and back out, and Blue fades in and remains visible. Green sets the Cue = 0.5 and Blue sets the Cue = 1.0.
<GridColumnDefinitions="100,100,100"Height="100">
<Rectanglex:Name="redRectangle"Fill="Red" />
<Rectanglex:Name="greenRectangle" Grid.Column="1"Fill="Green"Opacity="0" />
<Rectanglex:Name="blueRectangle" Grid.Column="2"Fill="Blue"Opacity="0" />
</Grid>
<TextBlockTextWrapping="Wrap">Red shape is always visible. Green shape animates Opacity property with Cue=0.5, Blue shape animates Opacity property with Cue=1.0. Only the Red and Blue shapes remain visible after clicking the button, which is inconsistent with WPF.</TextBlock>
<ToggleButtonx:Name="cueAnimationToggleButton"Content="Toggle this button to try and show the green and blue shapes"Click="OnTestCueAnimationButtonClick" />
WPF properly holds the last value animated, regardless of which cue time it had. Here is a simple sample with effectively the same code as above, but for WPF:
Note that after clicking the button, all three shapes remain visible.
<StackPanel>
<TextBlockText="❌ Boolean animation doesn't hold end" />
<GridHeight="100">
<Grid.ColumnDefinitions>
<ColumnDefinitionWidth="100" />
<ColumnDefinitionWidth="100" />
<ColumnDefinitionWidth="100" />
</Grid.ColumnDefinitions>
<Rectanglex:Name="redRectangle"Fill="Red" />
<Rectanglex:Name="greenRectangle" Grid.Column="1"Fill="Green"Opacity="0" />
<Rectanglex:Name="blueRectangle" Grid.Column="2"Fill="Blue"Opacity="0" />
</Grid>
<ToggleButtonx:Name="cueAnimationToggleButton"Content="Toggle this button to try and show the green and blue shapes"Click="OnTestCueAnimationButtonClick" />
</StackPanel>
While fixing some warnings across the solution, I came across the test AnimationIterationTests.Check_FillMode_End_Value, which has an warning coming from the xUnit analyzer because the tests parameters are unused.
Indeed, using the parameters made the test (correctly) fail for FillMode.Forward/FillMode.Both when the end cue isn't 1.0, which is this issue.
When running a
KeyFrame
animation withFillMode = Forward
, the last value that was animated in the animation should be what "holds" when the animation completes. This currently works but ONLY if the last value was set atCue = 1.0
. If the last value was set at any value before that, such asCue = 0.5
, it will not be held after the animation completes.Avalonia Repro
This sample has 3 rectangles. Red is always visible, while Green and Blue animate to be visible when the button is clicked. When the animation runs, Green fades in and back out, and Blue fades in and remains visible. Green sets the
Cue = 0.5
and Blue sets theCue = 1.0
.WPF Comparison
WPF properly holds the last value animated, regardless of which cue time it had. Here is a simple sample with effectively the same code as above, but for WPF:
The text was updated successfully, but these errors were encountered: