public LayerPropertiesModel(LayerPropertiesModel source = null) { if (source == null) { return; } // Clone the source's properties onto the new properties model (useful when changing property type) X = source.X; Y = source.Y; Width = source.Width; Height = source.Height; Contain = source.Contain; Opacity = source.Opacity; AnimationSpeed = source.AnimationSpeed; Conditions = source.Conditions; ConditionType = source.ConditionType; DynamicProperties = source.DynamicProperties; Brush = source.Brush; HeightEase = source.HeightEase; WidthEase = source.WidthEase; OpacityEase = source.OpacityEase; HeightEaseTime = source.HeightEaseTime; WidthEaseTime = source.WidthEaseTime; OpacityEaseTime = source.OpacityEaseTime; }
public void Draw(LayerPropertiesModel props, LayerPropertiesModel applied, DrawingContext c) { if (applied?.Brush == null) return; const int scale = 4; // Set up variables for this frame var rect = props.Contain ? new Rect(applied.X*scale, applied.Y*scale, applied.Width*scale, applied.Height*scale) : new Rect(props.X*scale, props.Y*scale, props.Width*scale, props.Height*scale); var clip = new Rect(applied.X*scale, applied.Y*scale, applied.Width*scale, applied.Height*scale); // Take an offset of 4 to allow layers to slightly leave their bounds var progress = (6.0 - props.AnimationProgress)*10.0; if (progress < 0) { // Can't meddle with the original brush because it's frozen. var brush = applied.Brush.Clone(); brush.Opacity = 1 + 0.025*progress; if (brush.Opacity < 0) brush.Opacity = 0; if (brush.Opacity > 1) brush.Opacity = 1; applied.Brush = brush; } rect.Inflate(-rect.Width/100.0*progress, -rect.Height/100.0*progress); clip.Inflate(-clip.Width/100.0*progress, -clip.Height/100.0*progress); c.PushClip(new RectangleGeometry(clip)); c.DrawRectangle(applied.Brush, null, rect); c.Pop(); }
internal void ApplyProperty(IDataModel dataModel, LayerPropertiesModel properties) { if (LayerPropertyType == LayerPropertyType.PercentageOf) ApplyPercentageOf(dataModel, properties, PercentageSource); if (LayerPropertyType == LayerPropertyType.PercentageOfProperty) ApplyPercentageOfProperty(dataModel, properties); }
internal void ApplyProperty(IDataModel dataModel, LayerPropertiesModel properties) { if (LayerPropertyType == LayerPropertyType.PercentageOf) { ApplyPercentageOf(dataModel, properties, PercentageSource); } if (LayerPropertyType == LayerPropertyType.PercentageOfProperty) { ApplyPercentageOfProperty(dataModel, properties); } }
private void ApplyHeight(LayerPropertiesModel properties, float percentage) { var newHeight = Math.Round(percentage*(float) properties.Height, 2); var difference = properties.Height - newHeight; if (newHeight < 0) newHeight = 0; properties.Height = newHeight; if (LayerPropertyOptions == LayerPropertyOptions.Downwards) properties.Y = properties.Y + difference; }
private void ApplyWidth(LayerPropertiesModel properties, float percentage) { var newWidth = Math.Round(percentage*(float) properties.Width, 2); var difference = properties.Width - newWidth; if (newWidth < 0) newWidth = 0; properties.Width = newWidth; // Apply the right to left option if (LayerPropertyOptions == LayerPropertyOptions.RightToLeft) properties.X = properties.X + difference; }
private void ApplyPercentageOf(IDataModel dataModel, LayerPropertiesModel properties, float src) { if (GameProperty == null) return; var gameProperty = dataModel.GetPropValue<float>(GameProperty); var percentage = gameProperty/src; if (LayerProperty == "Width") ApplyWidth(properties, percentage); else if (LayerProperty == "Height") ApplyHeight(properties, percentage); else if (LayerProperty == "Opacity") ApplyOpacity(properties, percentage); }
private void ApplyHeight(LayerPropertiesModel properties, float percentage) { var newHeight = Math.Round(percentage * (float)properties.Height, 2); var difference = properties.Height - newHeight; if (newHeight < 0) { newHeight = 0; } properties.Height = newHeight; if (LayerPropertyOptions == LayerPropertyOptions.Downwards) { properties.Y = properties.Y + difference; } }
public LayerPropertiesModel(LayerPropertiesModel source = null) { if (source == null) return; // Clone the source's properties onto the new properties model (useful when changing property type) X = source.X; Y = source.Y; Width = source.Width; Height = source.Height; Contain = source.Contain; Opacity = source.Opacity; AnimationSpeed = source.AnimationSpeed; Conditions = source.Conditions; DynamicProperties = source.DynamicProperties; Brush = source.Brush; }
private void ApplyWidth(LayerPropertiesModel properties, float percentage) { var newWidth = Math.Round(percentage * (float)properties.Width, 2); var difference = properties.Width - newWidth; if (newWidth < 0) { newWidth = 0; } properties.Width = newWidth; // Apply the right to left option if (LayerPropertyOptions == LayerPropertyOptions.RightToLeft) { properties.X = properties.X + difference; } }
public void Draw(LayerPropertiesModel props, LayerPropertiesModel applied, DrawingContext c) { if (applied.Brush == null) return; const int scale = 4; // Set up variables for this frame var rect = props.Contain ? new Rect(applied.X*scale, applied.Y*scale, applied.Width*scale, applied.Height*scale) : new Rect(props.X*scale, props.Y*scale, props.Width*scale, props.Height*scale); var s1 = new Rect(new Point(rect.X, rect.Y + props.AnimationProgress), new Size(rect.Width, rect.Height)); var s2 = new Rect(new Point(s1.X, s1.Y - rect.Height), new Size(rect.Width, rect.Height + .5)); var clip = new Rect(applied.X*scale, applied.Y*scale, applied.Width*scale, applied.Height*scale); c.PushClip(new RectangleGeometry(clip)); c.DrawRectangle(applied.Brush, null, s1); c.DrawRectangle(applied.Brush, null, s2); c.Pop(); }
public void Draw(LayerPropertiesModel props, LayerPropertiesModel applied, DrawingContext c) { if (applied.Brush == null) return; const int scale = 4; // Set up variables for this frame var rect = props.Contain ? new Rect(applied.X*scale, applied.Y*scale, applied.Width*scale, applied.Height*scale) : new Rect(props.X*scale, props.Y*scale, props.Width*scale, props.Height*scale); var clip = new Rect(applied.X*scale, applied.Y*scale, applied.Width*scale, applied.Height*scale); // Can't meddle with the original brush because it's frozen. var brush = applied.Brush.Clone(); brush.Opacity = (Math.Sin(props.AnimationProgress*Math.PI) + 1)*(props.Opacity/2); applied.Brush = brush; c.PushClip(new RectangleGeometry(clip)); c.DrawRectangle(applied.Brush, null, rect); c.Pop(); }
private void ApplyOpacity(LayerPropertiesModel properties, float percentage) { properties.Opacity = percentage * (float)properties.Opacity; if (properties.Opacity < 0.0) { properties.Opacity = 0.0; } if (properties.Opacity > 1.0) { properties.Opacity = 1.0; } // Apply the inverse/decrease option if (LayerPropertyOptions == LayerPropertyOptions.Decrease) { properties.Opacity = 1.0 - properties.Opacity; } var brush = properties.Brush.Clone(); brush.Opacity = properties.Opacity; properties.Brush = brush; }
private void ApplyPercentageOf(IDataModel dataModel, LayerPropertiesModel properties, float src) { if (GameProperty == null) { return; } var gameProperty = dataModel.GetPropValue <float>(GameProperty); var percentage = gameProperty / src; if (LayerProperty == "Width") { ApplyWidth(properties, percentage); } else if (LayerProperty == "Height") { ApplyHeight(properties, percentage); } else if (LayerProperty == "Opacity") { ApplyOpacity(properties, percentage); } }
public KeyPressPropertiesModel(LayerPropertiesModel properties) : base(properties) { }
public KeyboardPropertiesModel(LayerPropertiesModel properties = null) : base(properties) { }
public AudioPropertiesModel(LayerPropertiesModel properties) : base(properties) { }
private void ApplyOpacity(LayerPropertiesModel properties, float percentage) { properties.Opacity = percentage*(float) properties.Opacity; if (properties.Opacity < 0.0) properties.Opacity = 0.0; if (properties.Opacity > 1.0) properties.Opacity = 1.0; // Apply the inverse/decrease option if (LayerPropertyOptions == LayerPropertyOptions.Decrease) properties.Opacity = 1.0 - properties.Opacity; var brush = properties.Brush.Clone(); brush.Opacity = properties.Opacity; properties.Brush = brush; }
private void ApplyPercentageOfProperty(IDataModel dataModel, LayerPropertiesModel properties) { var value = dataModel.GetPropValue <float>(PercentageProperty); ApplyPercentageOf(dataModel, properties, value); }
public void Draw(LayerPropertiesModel props, LayerPropertiesModel applied, DrawingContext c) { }
private void ApplyPercentageOfProperty(IDataModel dataModel, LayerPropertiesModel properties) { var value = dataModel.GetPropValue<float>(PercentageProperty); ApplyPercentageOf(dataModel, properties, value); }