Browse Source

Move GlobalPlayState tracking to Clock.

pull/1715/head
Jeremy Koritzinsky 8 years ago
parent
commit
5c8ced89a3
  1. 7
      src/Avalonia.Animation/Animation.cs
  2. 2
      src/Avalonia.Animation/Clock.cs

7
src/Avalonia.Animation/Animation.cs

@ -17,10 +17,15 @@ namespace Avalonia.Animation
/// </summary>
public class Animation : AvaloniaList<KeyFrame>, IAnimation
{
/// <summary>
/// Gets or sets the animation play state for all animations
/// </summary>
public static PlayState GlobalPlayState { get; set; } = PlayState.Run;
public static PlayState GlobalPlayState
{
get => AvaloniaLocator.Current.GetService<Clock>().PlayState;
set => AvaloniaLocator.Current.GetService<Clock>().PlayState = value;
}
/// <summary>
/// Gets or sets the active time of this animation.

2
src/Avalonia.Animation/Clock.cs

@ -24,6 +24,8 @@ namespace Avalonia.Animation
public TimeSpan CurrentTime { get; private set; }
public PlayState PlayState { get; set; }
public void Pulse(long tickCount)
{
var time = TimeSpan.FromMilliseconds(tickCount);

Loading…
Cancel
Save