20 changed files with 72 additions and 73 deletions
@ -0,0 +1,27 @@ |
|||
using System; |
|||
using Avalonia.Logging; |
|||
using Avalonia.Media; |
|||
|
|||
namespace Avalonia.Animation.Animators |
|||
{ |
|||
/// <summary>
|
|||
/// Animator that handles <see cref="Thickness"/> properties.
|
|||
/// </summary>
|
|||
public class ThicknessAnimator : Animator<Thickness> |
|||
{ |
|||
public override Thickness Interpolate(double progress, Thickness oldValue, Thickness newValue) |
|||
{ |
|||
var deltaL = newValue.Left - oldValue.Left; |
|||
var deltaT = newValue.Top - oldValue.Top; |
|||
var deltaR = newValue.Right - oldValue.Right; |
|||
var deltaB = newValue.Bottom - oldValue.Bottom; |
|||
|
|||
var nL = progress * deltaL + oldValue.Left; |
|||
var nT = progress * deltaT + oldValue.Right; |
|||
var nR = progress * deltaR + oldValue.Top; |
|||
var nB = progress * deltaB + oldValue.Bottom; |
|||
|
|||
return new Thickness(nL, nT, nR, nB); |
|||
} |
|||
} |
|||
} |
|||
@ -1,27 +0,0 @@ |
|||
using System; |
|||
using Avalonia.Logging; |
|||
using Avalonia.Media; |
|||
|
|||
namespace Avalonia.Animation |
|||
{ |
|||
/// <summary>
|
|||
/// Animator that handles <see cref="Thickness"/> properties.
|
|||
/// </summary>
|
|||
public class ThicknessAnimator : Animator<Thickness> |
|||
{ |
|||
protected override Thickness Interpolate(double fraction, Thickness start, Thickness end) |
|||
{ |
|||
var deltaL = end.Left - start.Left; |
|||
var deltaT = end.Top - start.Top; |
|||
var deltaR = end.Right - start.Right; |
|||
var deltaB = end.Bottom - start.Bottom; |
|||
|
|||
var nL = fraction * deltaL + start.Left; |
|||
var nT = fraction * deltaT + start.Right; |
|||
var nR = fraction * deltaR + start.Top; |
|||
var nB = fraction * deltaB + start.Bottom; |
|||
|
|||
return new Thickness(nL, nT, nR, nB); |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue