private object obtainGradient(CanvasContext2D context, Particle particle) { var halfSize = (int) particle.Size >> 1; /* string key = halfSize + particle.DrawColor + particle.SizeSmall; if (grads.ContainsKey(key)) { return grads[key]; }*/ if (Game.DRAWFAST) return particle.DrawColor; var radgrad = context.CreateRadialGradient(halfSize, halfSize, particle.SizeSmall, halfSize, halfSize, halfSize); //var radgrad = context.CreateLinearGradient(halfSize, halfSize, particle.SizeSmall, halfSize); radgrad.AddColorStop(0, particle.DrawColor); radgrad.AddColorStop(1, particle.DrawColorTransparent); //Super cool if you change these values (and add more Color stops) return /*grads[key]=*/ radgrad; }