1 R.Engine.define({
  2     "class": "R.particles.effects.Spark",
  3     "requires": [
  4         "R.particles.effects.Spray",
  5         "R.math.Vector2D"
  6     ]
  7 });
  8 
  9 R.particles.effects.Spark = function() {
 10     return R.particles.effects.Spray.extend({
 11 
 12         _delay: 10,
 13         _delayVariance: 0,
 14         _lastDelayTime: 0,
 15 
 16         constructor: function(origin) {
 17             this.base(origin);
 18             this._delay = 10;
 19             this._delayVariance = 0;
 20             this._lastDelayTime = 0;
 21             return this;
 22         },
 23 
 24         delay: function(delay, delayVariance) {
 25             this._delay = delay;
 26             this._delayVariance = delayVariance || 0;
 27             return this;
 28         },
 29 
 30         generateParticles: function(particles, particleCount, particleLife, time, dt) {
 31 
 32             if (this._lastDelayTime == 0) {
 33                 this._lastDelayTime = time + this._delay + R.lang.Math2.randomRange(0, this._delayVariance, true);
 34             }
 35 
 36             if (time > this._lastDelayTime) {
 37                 this.base(particles, particleCount, particleLife, time, dt);
 38                 this._lastDelayTime = time + this._delay + R.lang.Math2.randomRange(0, this._delayVariance, true);
 39             }
 40 
 41         }
 42 
 43     }, {
 44         getClassName: function() {
 45             return "R.particles.effects.Spark";
 46         }
 47     });
 48 
 49 };
 50