CssAnimationDurationProperty
sealed class CssAnimationDurationProperty : CssProperty, ICssAnimationDurationProperty, ICssProperty
More information available at:
https://developer.mozilla.org/en-US/docs/CSS/animation-duration
using AngleSharp.Css;
using AngleSharp.Extensions;
using System.Collections.Generic;
namespace AngleSharp.Dom.Css
{
internal sealed class CssAnimationDurationProperty : CssProperty, ICssAnimationDurationProperty, ICssProperty
{
internal static readonly IValueConverter<Time> SingleConverter = Converters.TimeConverter;
internal static readonly IValueConverter<Time[]> Converter = SingleConverter.FromList();
internal static readonly Time Default = Time.Zero;
private readonly List<Time> _times;
public IEnumerable<Time> Durations => _times;
internal CssAnimationDurationProperty(CssStyleDeclaration rule)
: base(PropertyNames.AnimationDuration, rule, PropertyFlags.None)
{
_times = new List<Time>();
Reset();
}
public void SetDurations(IEnumerable<Time> times)
{
_times.Clear();
_times.AddRange(times);
}
internal override void Reset()
{
_times.Clear();
_times.Add(Default);
}
protected override bool IsValid(ICssValue value)
{
return Converter.TryConvert(value, SetDurations);
}
}
}