public void OpacityFunction(IParticle p) { int opacity = (int)(p.Params[0] + (p.Age * 100) % 500); opacity = Math.Abs((opacity < 250 ? opacity : 250 - opacity) % 255); p.Color = ColorPicker.FromArgb(opacity, p.Color); }
public override void Update(double ElapsedTime) { base.Update(ElapsedTime); _Limiter.Update(ElapsedTime); if (_Limiter.Ready && _Effecting) { Particle p = new Particle(RNG.Next(320), RNG.Next(4) + 1, RNG.Next(12)); p.TimeToLive = 5; p.X = x; p.Y = y; p.Color = ColorPicker.FromArgb(0, ColorPicker.RandomColor()); p.Transform += SinXFunction; p.Transform += SinYFunction; p.Transform += OpacityFunction; p.Model = AnimationFactory.GenerateAnimation("Images//particleloop.png", 32, 32, 5, 0.05); p.Image = p.Model.Frames[0]; //p.Image = new Frame("Images\\particle.png", new System.Drawing.Rectangle(0, 0, 32, 32), 0); this.Add(p); } }