Browse Source

Merge pull request #12364 from Coloryr/master

Make the animation display complete
pull/12347/head
Jumar Macato 3 years ago
committed by GitHub
parent
commit
ef1093a970
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 26
      src/Avalonia.Base/Animation/CrossFade.cs

26
src/Avalonia.Base/Animation/CrossFade.cs

@ -35,6 +35,18 @@ namespace Avalonia.Animation
{ {
Children = Children =
{ {
new KeyFrame()
{
Setters =
{
new Setter
{
Property = Visual.OpacityProperty,
Value = 1d
}
},
Cue = new Cue(0d)
},
new KeyFrame() new KeyFrame()
{ {
Setters = Setters =
@ -54,6 +66,18 @@ namespace Avalonia.Animation
{ {
Children = Children =
{ {
new KeyFrame()
{
Setters =
{
new Setter
{
Property = Visual.OpacityProperty,
Value = 0d
}
},
Cue = new Cue(0d)
},
new KeyFrame() new KeyFrame()
{ {
Setters = Setters =
@ -117,11 +141,13 @@ namespace Avalonia.Animation
if (from != null) if (from != null)
{ {
from.Opacity = 0f;
tasks.Add(_fadeOutAnimation.RunAsync(from, null, cancellationToken)); tasks.Add(_fadeOutAnimation.RunAsync(from, null, cancellationToken));
} }
if (to != null) if (to != null)
{ {
to.Opacity = 1f;
to.IsVisible = true; to.IsVisible = true;
tasks.Add(_fadeInAnimation.RunAsync(to, null, cancellationToken)); tasks.Add(_fadeInAnimation.RunAsync(to, null, cancellationToken));
} }

Loading…
Cancel
Save