Browse Source

Add `Point` animator.

pull/2163/head
Jumar Macato 8 years ago
parent
commit
ed90143e73
No known key found for this signature in database GPG Key ID: B19884DAC3A5BF3F
  1. 22
      src/Avalonia.Visuals/Animation/Animators/PointAnimator.cs

22
src/Avalonia.Visuals/Animation/Animators/PointAnimator.cs

@ -0,0 +1,22 @@
using System;
using Avalonia.Logging;
using Avalonia.Media;
namespace Avalonia.Animation.Animators
{
/// <summary>
/// Animator that handles <see cref="Point"/> properties.
/// </summary>
public class PointAnimator : Animator<Point>
{
public override Point Interpolate(double progress, Point oldValue, Point newValue)
{
var deltaX = newValue.X - oldValue.Y;
var deltaY = newValue.X - oldValue.Y;
var nX = progress * deltaX + oldValue.X;
var nY = progress * deltaY + oldValue.Y;
return new Point(nX, nY);
}
}
}
Loading…
Cancel
Save