Browse Source

repro

animation-fill-modes-test
Jumar Macato 6 years ago
parent
commit
388d9d604f
No known key found for this signature in database GPG Key ID: B19884DAC3A5BF3F
  1. 19
      samples/ControlCatalog/Pages/AutoCompleteBoxPage.xaml
  2. 10
      src/Avalonia.Animation/AnimationInstance`1.cs

19
samples/ControlCatalog/Pages/AutoCompleteBoxPage.xaml

@ -3,26 +3,21 @@
xmlns:l="clr-namespace:ControlCatalog.Pages;assembly=ControlCatalog" xmlns:l="clr-namespace:ControlCatalog.Pages;assembly=ControlCatalog"
x:Class="ControlCatalog.Pages.AutoCompleteBoxPage"> x:Class="ControlCatalog.Pages.AutoCompleteBoxPage">
<l:AutoCompleteBoxPage.Styles> <l:AutoCompleteBoxPage.Styles>
<Style Selector="l|AutoCompleteBoxPage[SideBarEnabled=False] Grid#sidebar"> <Style Selector="l|AutoCompleteBoxPage[SideBarEnabled=True] Grid#sidebar">
<Style.Animations> <Style.Animations>
<Animation Duration="0:0:0.5" FillMode="Both" Easing="QuadraticEaseIn"> <Animation Duration="0:0:0.5" FillMode="Both" Easing="QuadraticEaseOut">
<!-- <KeyFrame Cue="0%">
<Setter Property="Width" Value="250" />
</KeyFrame> -->
<KeyFrame Cue="100%"> <KeyFrame Cue="100%">
<Setter Property="Width" Value="0" /> <Setter Property="Width" Value="250" />
</KeyFrame> </KeyFrame>
</Animation> </Animation>
</Style.Animations> </Style.Animations>
</Style> </Style>
<Style Selector="l|AutoCompleteBoxPage[SideBarEnabled=True] Grid#sidebar"> <Style Selector="l|AutoCompleteBoxPage[SideBarEnabled=False] Grid#sidebar">
<Style.Animations> <Style.Animations>
<Animation Duration="0:0:0.5" FillMode="Both" Easing="QuadraticEaseOut"> <Animation Duration="0:0:0.5" FillMode="Both" Easing="QuadraticEaseIn">
<!-- <KeyFrame Cue="0%">
<Setter Property="Width" Value="0" />
</KeyFrame> -->
<KeyFrame Cue="100%"> <KeyFrame Cue="100%">
<Setter Property="Width" Value="250" /> <Setter Property="Width" Value="0" />
</KeyFrame> </KeyFrame>
</Animation> </Animation>
</Style.Animations> </Style.Animations>

10
src/Avalonia.Animation/AnimationInstance`1.cs

@ -119,9 +119,10 @@ namespace Avalonia.Animation
{ {
if (_fillMode == FillMode.Backward || _fillMode == FillMode.Both) if (_fillMode == FillMode.Backward || _fillMode == FillMode.Both)
if (_currentIteration == 0) if (_currentIteration == 0)
PublishNext(_firstKFValue); _targetControl.SetValue(_animator.Property, _firstKFValue, BindingPriority.LocalValue);
else else
PublishNext(_lastInterpValue); _targetControl.SetValue(_animator.Property, _lastInterpValue, BindingPriority.LocalValue);
} }
private void DoPlayStates() private void DoPlayStates()
@ -151,11 +152,14 @@ namespace Avalonia.Animation
if ((_fillMode == FillMode.Backward if ((_fillMode == FillMode.Backward
|| _fillMode == FillMode.Both) & indexTime == 0) || _fillMode == FillMode.Both) & indexTime == 0)
{ {
DoDelay();
_targetControl.SetValue(_animator.Property, _neutralValue, BindingPriority.LocalValue);
return;
} }
else if (indexTime > 0 & indexTime <= initDelay) else if (indexTime > 0 & indexTime <= initDelay)
{ {
DoDelay(); DoDelay();
return;
} }
else else
{ {

Loading…
Cancel
Save