Browse Source

Merge branch 'master' into emmauss/capture_gesture

pull/11518/head
Max Katz 3 years ago
committed by GitHub
parent
commit
896c039e68
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      packages/Avalonia/Avalonia.csproj
  2. 28
      src/Avalonia.Base/Animation/InterpolatingTransitionBase.cs

2
packages/Avalonia/Avalonia.csproj

@ -5,7 +5,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Avalonia.BuildServices" Version="0.0.16" />
<PackageReference Include="Avalonia.BuildServices" Version="0.0.18" />
<ProjectReference Include="../../src/Avalonia.Remote.Protocol/Avalonia.Remote.Protocol.csproj" />
<ProjectReference Include="../../src/Avalonia.Build.Tasks/Avalonia.Build.Tasks.csproj">
<PrivateAssets>all</PrivateAssets>

28
src/Avalonia.Base/Animation/InterpolatingTransitionBase.cs

@ -0,0 +1,28 @@
using System;
using Avalonia.Animation.Animators;
namespace Avalonia.Animation;
/// <summary>
/// The base class for user-defined transition that are doing simple value interpolation
/// </summary>
public abstract class InterpolatingTransitionBase<T> : Transition<T>
{
class Animator : Animator<T>
{
private readonly InterpolatingTransitionBase<T> _parent;
public Animator(InterpolatingTransitionBase<T> parent)
{
_parent = parent;
}
public override T Interpolate(double progress, T oldValue, T newValue) =>
_parent.Interpolate(progress, oldValue, newValue);
}
protected abstract T Interpolate(double progress, T from, T to);
internal override IObservable<T> DoTransition(IObservable<double> progress, T oldValue, T newValue) =>
new AnimatorTransitionObservable<T, Animator>(new Animator(this), progress, Easing, oldValue, newValue);
}
Loading…
Cancel
Save