/// <summary> /// Applies the provided keyframe to the control, /// overriding all needed properties /// </summary> /// <param name="frame"></param> public override void ApplyKeyFrame(KeyFrame startFrame, KeyFrame endFrame, float factor) { base.ApplyKeyFrame(startFrame, endFrame, factor); if (startFrame == null && endFrame == null) return; LabelLayout startLayout = startFrame != null ? startFrame.Layout as LabelLayout : null; LabelLayout endLayout = endFrame != null ? endFrame.Layout as LabelLayout : null; int r, g, b, a; float scaleX, scaleY; float skew; int dropShadow; if (endLayout == null) { r = startLayout.Color.R; g = startLayout.Color.G; b = startLayout.Color.B; a = startLayout.Color.A; scaleX = startLayout.Scale.Width; scaleY = startLayout.Scale.Height; skew = startLayout.Skew; dropShadow = startLayout.DropShadow; } else { r = (int)((float)startLayout.Color.R * (1.0f - factor) + (float)endLayout.Color.R * factor); g = (int)((float)startLayout.Color.G * (1.0f - factor) + (float)endLayout.Color.G * factor); b = (int)((float)startLayout.Color.B * (1.0f - factor) + (float)endLayout.Color.B * factor); a = (int)((float)startLayout.Color.A * (1.0f - factor) + (float)endLayout.Color.A * factor); scaleX = startLayout.Scale.Width * (1.0f - factor) + (float)endLayout.Scale.Width * factor; scaleY = startLayout.Scale.Height * (1.0f - factor) + (float)endLayout.Scale.Height * factor; skew = startLayout.Skew * (1.0f - factor) + endLayout.Skew * factor; dropShadow = (int)(startLayout.DropShadow * (1.0f - factor) + endLayout.DropShadow * factor); } this.Color = Color.FromArgb(a, r, g, b); this.Scale = new SizeF(scaleX, scaleY); this.Skew = skew; this.DropShadow = dropShadow; }
/// <summary> /// Applies the provided keyframe to the control, /// overriding all needed properties /// </summary> /// <param name="frame"></param> public override void ApplyKeyFrame(KeyFrame startFrame, KeyFrame endFrame, float factor) { base.ApplyKeyFrame(startFrame, endFrame, factor); CircleLayout startLayout = startFrame != null ? startFrame.Layout as CircleLayout : null; CircleLayout endLayout = endFrame != null ? endFrame.Layout as CircleLayout : null; if (startLayout == null && endLayout == null) return; int r, g, b, a; uint width, radius; if (endLayout == null) { r = startLayout.Color.R; g = startLayout.Color.G; b = startLayout.Color.B; a = startLayout.Color.A; width = startLayout.Width; radius = startLayout.Radius; } else { r = (int)((float)startLayout.Color.R * (1.0f - factor) + (float)endLayout.Color.R * factor); g = (int)((float)startLayout.Color.G * (1.0f - factor) + (float)endLayout.Color.G * factor); b = (int)((float)startLayout.Color.B * (1.0f - factor) + (float)endLayout.Color.B * factor); a = (int)((float)startLayout.Color.A * (1.0f - factor) + (float)endLayout.Color.A * factor); width = (uint)((float)startLayout.Width * (1.0f - factor) + (float)endLayout.Width * factor); radius = (uint)((float)startLayout.Radius * (1.0f - factor) + (float)endLayout.Radius * factor); } this.Radius = radius; this.Width = width; this.Color = Color.FromArgb(a, r, g, b); }
/// <summary> /// Clones this keyframe /// </summary> /// <returns></returns> public override object Clone() { KeyFrame keyframe = new KeyFrame(); keyframe.Frame = this.Frame; keyframe.Layout = this.Layout.Clone() as ControlLayout; keyframe.LeftAnchor = (AnchorData)this.LeftAnchor.Clone(); keyframe.RightAnchor = (AnchorData)this.RightAnchor.Clone(); keyframe.TopAnchor = (AnchorData)this.TopAnchor.Clone(); keyframe.BottomAnchor = (AnchorData)this.BottomAnchor.Clone(); keyframe.EaseFunction = this.EaseFunction; keyframe.EaseAmount = this.EaseAmount; return keyframe; }
/// <summary> /// Applies the provided keyframe to the control, /// overriding all needed properties /// </summary> /// <param name="frame"></param> public override void ApplyKeyFrame(KeyFrame startFrame, KeyFrame endFrame, float factor) { base.ApplyKeyFrame(startFrame, endFrame, factor); SpriteLayout startLayout = startFrame != null ? startFrame.Layout as SpriteLayout : null; SpriteLayout endLayout = endFrame != null ? endFrame.Layout as SpriteLayout : null; if (startLayout == null && endLayout == null) return; int r, g, b, a; float skew; if (endLayout == null) { r = startLayout.Color.R; g = startLayout.Color.G; b = startLayout.Color.B; a = startLayout.Color.A; skew = startLayout.Skew; } else { r = (int)((float)startLayout.Color.R * (1.0f - factor) + (float)endLayout.Color.R * factor); g = (int)((float)startLayout.Color.G * (1.0f - factor) + (float)endLayout.Color.G * factor); b = (int)((float)startLayout.Color.B * (1.0f - factor) + (float)endLayout.Color.B * factor); a = (int)((float)startLayout.Color.A * (1.0f - factor) + (float)endLayout.Color.A * factor); skew = startLayout.Skew * (1.0f - factor) + endLayout.Skew * factor; } this.Color = Color.FromArgb(a, r, g, b); this.Skew = skew; }
/// <summary> /// Applies the provided keyframe to the control, /// overriding all needed properties /// </summary> /// <param name="frame"></param> public override void ApplyKeyFrame(KeyFrame startFrame, KeyFrame endFrame, float factor) { base.ApplyKeyFrame(startFrame, endFrame, factor); MaskLayout startLayout = startFrame != null ? startFrame.Layout as MaskLayout : null; MaskLayout endLayout = endFrame != null ? endFrame.Layout as MaskLayout : null; if (startLayout == null && endLayout == null) return; float skew; if (endLayout == null) { skew = startLayout.Skew; } else { skew = startLayout.Skew * (1.0f - factor) + endLayout.Skew * factor; } this.Skew = skew; }