3 changed files with 38 additions and 0 deletions
@ -0,0 +1,20 @@ |
|||||
|
namespace Avalonia.Animation.Animators |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// Animator that handles <see cref="RelativePoint"/> properties.
|
||||
|
/// </summary>
|
||||
|
public class RelativePointAnimator : Animator<RelativePoint> |
||||
|
{ |
||||
|
private static readonly PointAnimator s_pointAnimator = new PointAnimator(); |
||||
|
|
||||
|
public override RelativePoint Interpolate(double progress, RelativePoint oldValue, RelativePoint newValue) |
||||
|
{ |
||||
|
if (oldValue.Unit != newValue.Unit) |
||||
|
{ |
||||
|
return progress >= 1 ? newValue : oldValue; |
||||
|
} |
||||
|
|
||||
|
return new RelativePoint(s_pointAnimator.Interpolate(progress, oldValue.Point, newValue.Point), oldValue.Unit); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,11 @@ |
|||||
|
using Avalonia.Animation.Animators; |
||||
|
|
||||
|
namespace Avalonia.Animation |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// Transition class that handles <see cref="AvaloniaProperty"/> with <see cref="RelativePoint"/> type.
|
||||
|
/// </summary>
|
||||
|
public class RelativePointTransition : AnimatorDrivenTransition<RelativePoint, RelativePointAnimator> |
||||
|
{ |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue