private void Complete() { // Remove from the update queue: Stop(); // Set target to the result. Css.Value target = RawTarget.Copy(); // Write it straight out to the computed style: // (Internally handles any aliases for us) Animation.ComputedStyle[InnerPropertyInfo] = target; // If it's not an alias, update hostValue: if (!InnerPropertyInfo.IsAlias) { PropertyValueObject = RawTarget; } if (UpdateCss) { // If we're the main animation (updateCss is true), tell the style it changed: // Note that in grouped properties, only the last one actually runs the update. Animation.ComputedStyle.ChangeProperty(PropertyInfo, PropertyValueObject); // And call the done function: Animation.Finished(); } }
public Value[] CopyInnerValues() { Value[] values = null; if (Values != null) { values = new Value[Values.Length]; for (int i = 0; i < Values.Length; i++) { Value value = Values[i]; if (value == null) { continue; } values[i] = value.Copy(); } } return(values); }
/// <summary>Figures out what kind of lerp is required with the given from/to values.</summary> public void ApplyValues(Css.Value from, Css.Value to) { // Get computed: if (from != null) { from = from.Computed; if (from.IsType(typeof(Css.Keywords.None))) { from = null; } } if (to != null) { to = to.Computed; if (to.IsType(typeof(Css.Keywords.None))) { to = null; } } // If both are null, do nothing. if (to == null && from == null) { return; } // If either is a cached transformValue, pull the origin: if (to != null && to is Css.Units.TransformValue) { Css.Units.TransformValue rawTo = to as Css.Units.TransformValue; to = rawTo.Origin; } if (from != null && from is Css.Units.TransformValue) { Css.Units.TransformValue rawFrom = from as Css.Units.TransformValue; from = rawFrom.Origin; } // If one or the other is null then it acts like the identity of the other. if (to != null && from != null) { // Check for functional equiv: if (!to.FunctionalEquals(from)) { // Matrix interpolation :'( // Bake both matrices: RenderableData rd = Animation.ComputedStyle.RenderData; Matrix4x4 fromMatrix = Css.Properties.TransformProperty.Compute(from, rd); Matrix4x4 toMatrix = Css.Properties.TransformProperty.Compute(to, rd); // If either is 3D then they both are treated as 3D values: if (Css.Properties.TransformProperty.Is3D(from) || Css.Properties.TransformProperty.Is3D(to)) { // 3D! // Write out into this value (no prep required here): FromFunctions = new InterpolationMatrix3D(fromMatrix); ToFunctions = new InterpolationMatrix3D(toMatrix); } else { // 2D! // Write out into this value: InterpolationMatrix fromInt = new InterpolationMatrix(fromMatrix); InterpolationMatrix toInt = new InterpolationMatrix(toMatrix); // Prep for interpolation: fromInt.PrepareForInterpolate(toInt); ToFunctions = toInt; FromFunctions = fromInt; } // Copy the from value: ActiveFunctions = FromFunctions.Copy(); // Write it back out: WriteOut(); return; } } // Interpolate every parameter of each function (if the other is null, use 0) // Note! The same function can appear multiple times. ToFunctions = to; FromFunctions = from; if (FromFunctions == null) { // Copy to (going from none) and set it all as zero: ActiveFunctions = ToFunctions.Copy(); // Set it all to 'zero' (it's e.g. 1 for scale though!) SetDefaults(ActiveFunctions); } else { // Copy from: ActiveFunctions = FromFunctions.Copy(); } // Write it back out: WriteOut(); }