diff --git a/src/Avalonia.Animation/Animation.cs b/src/Avalonia.Animation/Animation.cs
index 7b3aa06ea0..e787143b59 100644
--- a/src/Avalonia.Animation/Animation.cs
+++ b/src/Avalonia.Animation/Animation.cs
@@ -154,12 +154,12 @@ namespace Avalonia.Animation
}
///
- public IDisposable Apply(Animatable control, IObservable match, Action onComplete)
+ public IDisposable Apply(Animatable control, Clock clock, IObservable match, Action onComplete)
{
var (animators, subscriptions) = InterpretKeyframes(control);
if (animators.Count == 1)
{
- subscriptions.Add(animators[0].Apply(this, control, match, onComplete));
+ subscriptions.Add(animators[0].Apply(this, control, clock, match, onComplete));
}
else
{
@@ -173,7 +173,7 @@ namespace Avalonia.Animation
animatorOnComplete = () => tcs.SetResult(null);
completionTasks.Add(tcs.Task);
}
- subscriptions.Add(animator.Apply(this, control, match, animatorOnComplete));
+ subscriptions.Add(animator.Apply(this, control, clock, match, animatorOnComplete));
}
if (onComplete != null)
@@ -185,15 +185,20 @@ namespace Avalonia.Animation
}
///
- public Task RunAsync(Animatable control)
+ public Task RunAsync(Animatable control, Clock clock = null)
{
+ if (clock == null)
+ {
+ clock = Clock.GlobalClock;
+ }
+
var run = new TaskCompletionSource