コード例 #1
0
        Transition?ParseValue(CSSValue value)
        {
            var delay    = Time.Zero;
            var duration = Time.Zero;
            var function = value.ToTimingFunction();
            var property = "all";

            if (function == null)
            {
                function = CSSTimingValue.Ease;

                if (value is CSSIdentifierValue)
                {
                    property = ((CSSIdentifierValue)value).Value;
                }
                else if (value is CSSPrimitiveValue <Time> )
                {
                    duration = value.ToTime().Value;
                }
                else
                {
                    return(null);
                }
            }

            return(new Transition
            {
                Delay = delay,
                Duration = duration,
                Timing = function,
                Property = property
            });
        }
コード例 #2
0
        Animation?ParseValue(CSSValue value)
        {
            var delay          = Time.Zero;
            var duration       = Time.Zero;
            var function       = value.ToTimingFunction();
            var name           = "none";
            var iterationCount = 1f;

            if (function == null)
            {
                function = CSSTimingValue.Ease;

                if (value is CSSIdentifierValue)
                {
                    name = ((CSSIdentifierValue)value).Value;
                }
                else if (value is CSSPrimitiveValue <Time> )
                {
                    duration = value.ToTime().Value;
                }
                else if (value is CSSPrimitiveValue <Number> )
                {
                    iterationCount = value.ToNumber().Value;
                }
                else
                {
                    return(null);
                }
            }

            return(new Animation
            {
                Delay = delay,
                Duration = duration,
                Timing = function,
                Name = name,
                IterationCount = iterationCount,
                FillMode = AnimationFillMode.None,
                Direction = AnimationDirection.Normal
            });
        }