56 changed files with 358 additions and 64 deletions
@ -0,0 +1,59 @@ |
|||||
|
// -----------------------------------------------------------------------
|
||||
|
// <copyright file="Animation`1.cs" company="Steven Kirk">
|
||||
|
// Copyright 2015 MIT Licence. See licence.md for more information.
|
||||
|
// </copyright>
|
||||
|
// -----------------------------------------------------------------------
|
||||
|
|
||||
|
namespace Perspex.Animation |
||||
|
{ |
||||
|
using System; |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Tracks the progress of an animation.
|
||||
|
/// </summary>
|
||||
|
/// <typeparam name="T">The type of the value being animated./</typeparam>
|
||||
|
public class Animation<T> : IObservable<T>, IDisposable |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// The animation being tracked.
|
||||
|
/// </summary>
|
||||
|
private IObservable<T> inner; |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// The disposable used to cancel the animation.
|
||||
|
/// </summary>
|
||||
|
private IDisposable subscription; |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Initializes a new instance of the <see cref="Animation{T}"/> class.
|
||||
|
/// </summary>
|
||||
|
/// <param name="inner">The animation observable being tracked.</param>
|
||||
|
/// <param name="subscription">A disposable used to cancel the animation.</param>
|
||||
|
public Animation(IObservable<T> inner, IDisposable subscription) |
||||
|
{ |
||||
|
this.inner = inner; |
||||
|
this.subscription = subscription; |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Cancels the animation.
|
||||
|
/// </summary>
|
||||
|
public void Dispose() |
||||
|
{ |
||||
|
this.subscription.Dispose(); |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Notifies the provider that an observer is to receive notifications.
|
||||
|
/// </summary>
|
||||
|
/// <param name="observer">The observer.</param>
|
||||
|
/// <returns>
|
||||
|
/// A reference to an interface that allows observers to stop receiving notifications
|
||||
|
/// before the provider has finished sending them.
|
||||
|
/// </returns>
|
||||
|
public IDisposable Subscribe(IObserver<T> observer) |
||||
|
{ |
||||
|
return this.inner.Subscribe(observer); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -1,18 +1,26 @@ |
|||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||
// <copyright file="PropertyTransition.cs" company="Steven Kirk">
|
// <copyright file="IEasing.cs" company="Steven Kirk">
|
||||
// Copyright 2014 MIT Licence. See licence.md for more information.
|
// Copyright 2014 MIT Licence. See licence.md for more information.
|
||||
// </copyright>
|
// </copyright>
|
||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||
|
|
||||
namespace Perspex.Animation |
namespace Perspex.Animation |
||||
{ |
{ |
||||
|
/// <summary>
|
||||
|
/// Defines the interface for easing functions.
|
||||
|
/// </summary>
|
||||
public interface IEasing |
public interface IEasing |
||||
{ |
{ |
||||
|
/// <summary>
|
||||
|
/// Returns the value of the transition for the specified progress.
|
||||
|
/// </summary>
|
||||
|
/// <param name="progress">The progress of the transition, from 0 to 1.</param>
|
||||
|
/// <param name="start">The start value of the transition.</param>
|
||||
|
/// <param name="finish">The end value of the transition.</param>
|
||||
|
/// <returns>
|
||||
|
/// A value between <paramref name="start"/> and <paramref name="finish"/> as determined
|
||||
|
/// by <paramref name="progress"/>.
|
||||
|
/// </returns>
|
||||
object Ease(double progress, object start, object finish); |
object Ease(double progress, object start, object finish); |
||||
} |
} |
||||
|
|
||||
public interface IEasing<T> : IEasing |
|
||||
{ |
|
||||
T Ease(double progress, T start, T finish); |
|
||||
} |
|
||||
} |
} |
||||
|
|||||
@ -0,0 +1,27 @@ |
|||||
|
// -----------------------------------------------------------------------
|
||||
|
// <copyright file="IEasing`1.cs" company="Steven Kirk">
|
||||
|
// Copyright 2014 MIT Licence. See licence.md for more information.
|
||||
|
// </copyright>
|
||||
|
// -----------------------------------------------------------------------
|
||||
|
|
||||
|
namespace Perspex.Animation |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// Defines the interface for easing functions.
|
||||
|
/// </summary>
|
||||
|
/// <typeparam name="T">The type of the property being transitioned.</typeparam>
|
||||
|
public interface IEasing<T> : IEasing |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// Returns the value of the transition for the specified progress.
|
||||
|
/// </summary>
|
||||
|
/// <param name="progress">The progress of the transition, from 0 to 1.</param>
|
||||
|
/// <param name="start">The start value of the transition.</param>
|
||||
|
/// <param name="finish">The end value of the transition.</param>
|
||||
|
/// <returns>
|
||||
|
/// A value between <paramref name="start"/> and <paramref name="finish"/> as determined
|
||||
|
/// by <paramref name="progress"/>.
|
||||
|
/// </returns>
|
||||
|
T Ease(double progress, T start, T finish); |
||||
|
} |
||||
|
} |
||||
@ -1,8 +1,9 @@ |
|||||
<?xml version="1.0" encoding="utf-8"?> |
<?xml version="1.0" encoding="utf-8"?> |
||||
<packages> |
<packages> |
||||
<package id="Rx-Core" version="2.2.5" targetFramework="portable-net45+win" /> |
<package id="Rx-Core" version="2.2.5" targetFramework="portable-net45+win8" userInstalled="true" /> |
||||
<package id="Rx-Interfaces" version="2.2.5" targetFramework="portable-net45+win" /> |
<package id="Rx-Interfaces" version="2.2.5" targetFramework="portable-net45+win8" userInstalled="true" /> |
||||
<package id="Rx-Linq" version="2.2.5" targetFramework="portable-net45+win" /> |
<package id="Rx-Linq" version="2.2.5" targetFramework="portable-net45+win8" userInstalled="true" /> |
||||
<package id="Rx-Main" version="2.2.5" targetFramework="portable-net45+win" /> |
<package id="Rx-Main" version="2.2.5" targetFramework="portable-net45+win8" userInstalled="true" /> |
||||
<package id="Rx-PlatformServices" version="2.2.5" targetFramework="portable-net45+win" /> |
<package id="Rx-PlatformServices" version="2.2.5" targetFramework="portable-net45+win8" userInstalled="true" /> |
||||
|
<package id="StyleCop.Analyzers" version="1.0.0-alpha008" targetFramework="portable45-net45+win8" userInstalled="true" /> |
||||
</packages> |
</packages> |
||||
@ -0,0 +1,4 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<packages> |
||||
|
<package id="StyleCop.Analyzers" version="1.0.0-alpha008" targetFramework="portable45-net45+win8" userInstalled="true" /> |
||||
|
</packages> |
||||
Loading…
Reference in new issue