/// <summary> /// Constructor with 2 opacity values. /// </summary> /// <param name="initial">Initial opacity.</param> /// <param name="ultimate">Ultimate opacity.</param> public OpacityModifier(float initial, float ultimate) { initial = MathHelper.Clamp(initial, 0f, 1f); ultimate = MathHelper.Clamp(ultimate, 0f, 1f); CurveKeyCollection keys = new CurveKeyCollection(); keys.Add(new CurveKey(0f, initial)); keys.Add(new CurveKey(1f, ultimate)); Initialise(keys); }
/// <summary> /// Creates a ScaleModifier with 2 scale values. /// </summary> /// <param name="initial">Initial scale.</param> /// <param name="ultimate">Ultimate scale.</param> public ScaleModifier(float initial, float ultimate) { initial = (float)Math.Max(initial, 0f); ultimate = (float)Math.Max(ultimate, 0f); CurveKeyCollection keys = new CurveKeyCollection(); keys.Add(new CurveKey(0f, initial)); keys.Add(new CurveKey(1f, ultimate)); Initialise(keys); }
public void Setup() { k1 = new CurveKey(12, 123); k2 = new CurveKey(11, 11); k3 = new CurveKey(-1, -11); c = new CurveKeyCollection(); c.Add(k1); c.Add(k2); c.Add(k3); }
/// <summary> /// Constructor with 2 opacity values. /// </summary> /// <param name="initial">Initial opacity.</param> /// <param name="ultimate">Ultimate opacity.</param> public OpacityModifier(float initial, float ultimate) { initial = MathHelper.Clamp(initial, 0f, 1f); ultimate = MathHelper.Clamp(ultimate, 0f, 1f); CurveKeyCollection keys = new CurveKeyCollection(); keys.Add(new CurveKey(0f, initial)); keys.Add(new CurveKey(1f, ultimate)); Initialize(keys); }
/// <summary> /// Creates a ScaleModifier with 2 scale values. /// </summary> /// <param name="initial">Initial scale.</param> /// <param name="ultimate">Ultimate scale.</param> public ScaleModifier(float initial, float ultimate) { initial = (float)Math.Max(initial, 0f); ultimate = (float)Math.Max(ultimate, 0f); CurveKeyCollection keys = new CurveKeyCollection(); keys.Add(new CurveKey(0f, initial)); keys.Add(new CurveKey(1f, ultimate)); Initialize(keys); }
/// <summary> /// Creates a ScaleModifier with 3 scale values. /// </summary> /// <param name="initial">Initial scale.</param> /// <param name="mid">Middle scale.</param> /// <param name="sweep">Position of middle scale.</param> /// <param name="ultimate">Ultimate scale.</param> public ScaleModifier(float initial, float mid, float sweep, float ultimate) { initial = (float)Math.Max(initial, 0f); mid = (float)Math.Max(mid, 0f); sweep = MathHelper.Clamp(sweep, 0f, 1f); ultimate = (float)Math.Max(ultimate, 0f); CurveKeyCollection keys = new CurveKeyCollection(); keys.Add(new CurveKey(0f, initial)); keys.Add(new CurveKey(sweep, mid)); keys.Add(new CurveKey(1f, ultimate)); Initialise(keys); }
/// <summary> /// Creates a ScaleModifier with 3 scale values. /// </summary> /// <param name="initial">Initial scale.</param> /// <param name="mid">Middle scale.</param> /// <param name="sweep">Position of middle scale.</param> /// <param name="ultimate">Ultimate scale.</param> public ScaleModifier(float initial, float mid, float sweep, float ultimate) { initial = (float)Math.Max(initial, 0f); mid = (float)Math.Max(mid, 0f); sweep = MathHelper.Clamp(sweep, 0f, 1f); ultimate = (float)Math.Max(ultimate, 0f); CurveKeyCollection keys = new CurveKeyCollection(); keys.Add(new CurveKey(0f, initial)); keys.Add(new CurveKey(sweep, mid)); keys.Add(new CurveKey(1f, ultimate)); Initialize(keys); }
/// <summary> /// Creates a ColorModifier with 2 color values. /// </summary> /// <param name="initial">Initial color of Particles.</param> /// <param name="ultimate">Ultimate color of Particles.</param> public ColorModifier(Color initial, Color ultimate) { CurveKeyCollection keysRed = new CurveKeyCollection(); keysRed.Add(new CurveKey(0f, (float)initial.R / 255f)); keysRed.Add(new CurveKey(1f, (float)ultimate.R / 255f)); CurveKeyCollection keysGreen = new CurveKeyCollection(); keysGreen.Add(new CurveKey(0f, (float)initial.G / 255f)); keysGreen.Add(new CurveKey(1f, (float)ultimate.G / 255f)); CurveKeyCollection keysBlue = new CurveKeyCollection(); keysBlue.Add(new CurveKey(0f, (float)initial.B / 255f)); keysBlue.Add(new CurveKey(1f, (float)ultimate.B / 255f)); Initialise(keysRed, keysGreen, keysBlue); }
/// <summary> /// Creates a ColorModifier with 2 color values. /// </summary> /// <param name="initial">Initial color of Particles.</param> /// <param name="ultimate">Ultimate color of Particles.</param> public ColorModifier(Color initial, Color ultimate) { CurveKeyCollection keysRed = new CurveKeyCollection(); keysRed.Add(new CurveKey(0f, (float)initial.R / 255f)); keysRed.Add(new CurveKey(1f, (float)ultimate.R / 255f)); CurveKeyCollection keysGreen = new CurveKeyCollection(); keysGreen.Add(new CurveKey(0f, (float)initial.G / 255f)); keysGreen.Add(new CurveKey(1f, (float)ultimate.G / 255f)); CurveKeyCollection keysBlue = new CurveKeyCollection(); keysBlue.Add(new CurveKey(0f, (float)initial.B / 255f)); keysBlue.Add(new CurveKey(1f, (float)ultimate.B / 255f)); Initialize(keysRed, keysGreen, keysBlue); }
public void Add() { CurveKey k = new CurveKey(123, 123); c.Add(k); Assert.AreEqual(4, c.Count, "#1"); Assert.AreEqual(k, c[3], "#2"); c.Add(k); Assert.AreEqual(5, c.Count, "#3"); Assert.AreEqual(k, c[4], "#4"); }