Browse Source
Fix: Crossfade animation causes other animations to have hidden elements (#14832 )
* Fix: Remove the property changes, let the animation take care of the opacity
* Fix: Remove disposables that are no longer required
---------
Co-authored-by: Matt Blacker <matt@aspireweb.com.au>
pull/14843/head
Matt Blacker
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with
13 additions and
22 deletions
src/Avalonia.Base/Animation/CrossFade.cs
@ -132,32 +132,23 @@ namespace Avalonia.Animation
}
var tasks = new List < Task > ( ) ;
using ( var disposables = new CompositeDisposable ( 1 ) )
{
if ( to ! = null )
{
disposables . Add ( to . SetValue ( Visual . OpacityProperty , 0 , Data . BindingPriority . Animation ) ! ) ;
}
if ( from ! = null )
{
from . Opacity = 0f ;
tasks . Add ( _f adeOutAnimation . RunAsync ( from , null , cancellationToken ) ) ;
}
if ( from ! = null )
{
tasks . Add ( _f adeOutAnimation . RunAsync ( from , null , cancellationToken ) ) ;
}
if ( to ! = null )
{
to . Opacity = 1f ;
to . IsVisible = true ;
tasks . Add ( _f adeInAnimation . RunAsync ( to , null , cancellationToken ) ) ;
}
if ( to ! = null )
{
to . IsVisible = true ;
tasks . Add ( _f adeInAnimation . RunAsync ( to , null , cancellationToken ) ) ;
}
await Task . WhenAll ( tasks ) ;
await Task . WhenAll ( tasks ) ;
if ( from ! = null & & ! cancellationToken . IsCancellationRequested )
{
from . IsVisible = false ;
}
if ( from ! = null & & ! cancellationToken . IsCancellationRequested )
{
from . IsVisible = false ;
}
}