Example #1
0
        // TODO: Keyframes

        public override CssNode CloneNode()
        {
            var rule = new KeyframesRule(Name);

            foreach (var child in Children)
            {
                rule.Add(child.CloneNode());
            }

            return(rule);
        }
Example #2
0
        // TODO: Keyframes
        public override CssNode CloneNode()
        {
            var rule = new KeyframesRule(Name);

            foreach (var x in children)
            {
                rule.Add(x.CloneNode());
            }

            return rule;
        }
Example #3
0
        public override ApplyState Apply(ComputedStyle style, Value value)
        {
            // The name of the animation:
            string name = null;

            if (value != null)
            {
                // Get the name:
                name = value.GetText(style.RenderData, this);
            }

            if (name == "none" || name == "initial" || name == "normal")
            {
                name = null;
            }

            // Get the animation:
            KeyframesRule animation = style.document.GetAnimation(name);

            if (animation == null)
            {
                // Clear:

                if (style.AnimationInstance != null)
                {
                    // Stop without triggering OnDone:
                    style.AnimationInstance.Stop(false);
                }

                // Reset matched styles
                style.ApplyMatchedStyles();

                // Ok!
                return(ApplyState.Ok);
            }

            if (style.AnimationInstance != null)
            {
                if (style.AnimationInstance.RawAnimation == animation)
                {
                    // Stop there.
                    return(ApplyState.Ok);
                }
                else
                {
                    // Stop it:
                    style.AnimationInstance.Stop(false);

                    // Reset matched:
                    style.ApplyMatchedStyles();
                }
            }

            // Create an instance:
            style.AnimationInstance = new KeyframesAnimationInstance(style, animation);

            // Reapply other values:
            Reapply(style, "animation-duration");
            Reapply(style, "animation-timing-function");
            Reapply(style, "animation-delay");
            Reapply(style, "animation-iteration-count");
            Reapply(style, "animation-direction");
            Reapply(style, "animation-fill-mode");
            Reapply(style, "animation-play-state");

            // Start it:
            style.AnimationInstance.Start();

            // Ok!
            return(ApplyState.Ok);
        }
Example #4
0
        public CssRule ReadKeyframesRule()
        {
            // @media only screen and (min-width : 1600px) {

            var span = new TokenList();

            while (current.Kind != TokenKind.BlockStart && !isEnd)
            {
                span.Add(Read()); // Read the token
            }

            var rule = new KeyframesRule(span.RawText.Trim());

            ReadBlock(rule);

            return rule;
        }