Browse Source
*Disabled old animations code in CrossFade, PageSlide, CarouselPresenter and ProgressBar.pull/1461/head
9 changed files with 108 additions and 46 deletions
@ -0,0 +1,23 @@ |
|||
// Copyright (c) The Avalonia Project. All rights reserved.
|
|||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
|||
|
|||
using Avalonia.Metadata; |
|||
using System; |
|||
using System.Reactive.Linq; |
|||
|
|||
namespace Avalonia.Animation |
|||
{ |
|||
/// <summary>
|
|||
/// Transition class that handles <see cref="AvaloniaProperty"/> with <see cref="float"/> types.
|
|||
/// </summary>
|
|||
public class FloatTransition : Transition<float> |
|||
{ |
|||
/// <inheritdocs/>
|
|||
public override IObservable<float> DoInterpolation(IObservable<double> progress, float oldValue, float newValue) |
|||
{ |
|||
var delta = newValue - oldValue; |
|||
return progress |
|||
.Select(p => (float)Easing.Ease(p) * delta + oldValue); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,26 @@ |
|||
// Copyright (c) The Avalonia Project. All rights reserved.
|
|||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
|||
|
|||
using Avalonia.Metadata; |
|||
using System; |
|||
using System.Reactive.Linq; |
|||
|
|||
namespace Avalonia.Animation |
|||
{ |
|||
/// <summary>
|
|||
/// Interface for <see cref="Transition{T}"/> objects.
|
|||
/// </summary>
|
|||
public interface ITransition |
|||
{ |
|||
/// <summary>
|
|||
/// Applies the transition to the specified <see cref="Animatable"/>.
|
|||
/// </summary>
|
|||
IDisposable Apply(Animatable control, object oldValue, object newValue); |
|||
|
|||
/// <summary>
|
|||
/// Gets the property to be animated.
|
|||
/// </summary>
|
|||
AvaloniaProperty Property { get; set; } |
|||
|
|||
} |
|||
} |
|||
@ -0,0 +1,23 @@ |
|||
// Copyright (c) The Avalonia Project. All rights reserved.
|
|||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
|||
|
|||
using Avalonia.Metadata; |
|||
using System; |
|||
using System.Reactive.Linq; |
|||
|
|||
namespace Avalonia.Animation |
|||
{ |
|||
/// <summary>
|
|||
/// Transition class that handles <see cref="AvaloniaProperty"/> with <see cref="int"/> types.
|
|||
/// </summary>
|
|||
public class IntegerTransition : Transition<int> |
|||
{ |
|||
/// <inheritdocs/>
|
|||
public override IObservable<int> DoInterpolation(IObservable<double> progress, int oldValue, int newValue) |
|||
{ |
|||
var delta = newValue - oldValue; |
|||
return progress |
|||
.Select(p => (int)(Easing.Ease(p) * delta + oldValue)); |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue