Browse Source

Merge branch 'animations/tryfix-scb-localvalue' of github.com:AvaloniaUI/Avalonia into animations/tryfix-scb-localvalue

pull/5886/head
Dan Walmsley 5 years ago
parent
commit
8bdf16a716
  1. 11
      src/Avalonia.Visuals/Animation/Animators/BaseBrushAnimator.cs

11
src/Avalonia.Visuals/Animation/Animators/BaseBrushAnimator.cs

@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reactive.Disposables;
using Avalonia.Logging;
using Avalonia.Media;
@ -17,7 +16,8 @@ namespace Avalonia.Animation.Animators
{
private IAnimator _targetAnimator;
private static readonly List<(Func<Type, bool> Match, Type AnimatorType)> _brushAnimators = new List<(Func<Type, bool> Match, Type AnimatorType)>();
private static readonly List<(Func<Type, bool> Match, Type AnimatorType)> _brushAnimators =
new List<(Func<Type, bool> Match, Type AnimatorType)>();
/// <summary>
/// Register an <see cref="Animator{T}"/> that handles a specific
@ -35,14 +35,15 @@ namespace Avalonia.Animation.Animators
{
_brushAnimators.Insert(0, (condition, typeof(TAnimator)));
}
/// <inheritdoc/>
public override IDisposable Apply(Animation animation, Animatable control, IClock clock,
IObservable<bool> match, Action onComplete)
{
foreach (var valueType in _brushAnimators
.Where(valueType => valueType.Match(this[0].Value.GetType())))
foreach (var valueType in _brushAnimators)
{
if (!valueType.Match(this[0].Value.GetType())) continue;
_targetAnimator = (IAnimator)Activator.CreateInstance(valueType.AnimatorType);
foreach (var keyframe in this)

Loading…
Cancel
Save