using System; using System.Collections.Generic; using Avalonia.Collections; using Avalonia.Metadata; namespace Avalonia.Animation { internal enum KeyFrameTimingMode { TimeSpan = 1, Cue } /// /// Stores data regarding a specific key /// point and value in an animation. /// public class KeyFrame : AvaloniaObject { private TimeSpan _ktimeSpan; private Cue _kCue; public KeyFrame() { } /// /// Gets the setters of . /// [Content] public AvaloniaList Setters { get; } = new AvaloniaList(); internal KeyFrameTimingMode TimingMode { get; private set; } /// /// Gets or sets the key time of this . /// /// The key time. public TimeSpan KeyTime { get { return _ktimeSpan; } set { if (TimingMode == KeyFrameTimingMode.Cue) { throw new InvalidOperationException($"You can only set either {nameof(KeyTime)} or {nameof(Cue)}."); } TimingMode = KeyFrameTimingMode.TimeSpan; _ktimeSpan = value; } } /// /// Gets or sets the cue of this . /// /// The cue. public Cue Cue { get { return _kCue; } set { if (TimingMode == KeyFrameTimingMode.TimeSpan) { throw new InvalidOperationException($"You can only set either {nameof(KeyTime)} or {nameof(Cue)}."); } TimingMode = KeyFrameTimingMode.Cue; _kCue = value; } } } }