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); }
public override ApplyState Apply(ComputedStyle style, Value value) { // The name of the slides: string name = null; if (value != null) { // Get the name: name = value.GetText(style.RenderData, this); } if (name == "none" || name == "initial" || name == "normal") { name = null; } // Already running a slides instance? Timeline timeline = Timeline.get(style); if (name == null) { // Clear: if (timeline != null) { // Stop without triggering done: timeline.stop(false); } // Reset matched styles style.ApplyMatchedStyles(); // Ok! return(ApplyState.Ok); } if (timeline != null) { /* * This blocks interrupts - we allow it through * Because the user must've got past the values being non-identical check. * * if(timeline.src==name){ * // Stop there - already running this timeline instance. * return ApplyState.Ok; * } */ // Stop it without done: timeline.stop(false); // Reset matched: style.ApplyMatchedStyles(); } // Create timeline: timeline = new Timeline(style); timeline.src = name; // Enqueue it (adds to the update queue, but not the same as a start call): timeline.enqueue(); // Reapply other values: Reapply(style, "timeline-duration"); Reapply(style, "timeline-timing-function"); Reapply(style, "timeline-delay"); Reapply(style, "timeline-iteration-count"); Reapply(style, "timeline-direction"); //Reapply(style,"timeline-fill-mode"); //Reapply(style,"timeline-play-state"); Timeline.open(name, style.Element.document.basepath, timeline).then(delegate(object o){ // Still enqueued? if (timeline.isEnqueued) { // Start it now! timeline.start(); } }, delegate(object fail){ Dom.Log.Add("Failed to start PowerSlide (via CSS): " + fail); }); // Ok! return(ApplyState.Ok); }