safex-webgl 1.2.2 → 1.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,839 +0,0 @@
1
- /****************************************************************************
2
- Copyright (c) 2008-2010 Ricardo Quesada
3
- Copyright (c) 2011-2012 cocos2d-x.org
4
- Copyright (c) 2013-2014 Chukong Technologies Inc.
5
-
6
- http://www.cocos2d-x.org
7
-
8
- Permission is hereby granted, free of charge, to any person obtaining a copy
9
- of this software and associated documentation files (the "Software"), to deal
10
- in the Software without restriction, including without limitation the rights
11
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
- copies of the Software, and to permit persons to whom the Software is
13
- furnished to do so, subject to the following conditions:
14
-
15
- The above copyright notice and this permission notice shall be included in
16
- all copies or substantial portions of the Software.
17
-
18
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
- THE SOFTWARE.
25
- ****************************************************************************/
26
- /**
27
- * A fire particle system
28
- * @class
29
- * @extends cc.ParticleSystem
30
- *
31
- * @example
32
- * var emitter = new cc.ParticleFire();
33
- */
34
- cc.ParticleFire = cc.ParticleSystem.extend(/** @lends cc.ParticleFire# */ {
35
- /**
36
- * <p>The cc.ParticleFire's constructor. <br/>
37
- * This function will automatically be invoked when you create a node using new construction: "var node = new cc.ParticleFire()".<br/>
38
- * Override it to extend its behavior, remember to call "this._super()" in the extended "ctor" function.</p>
39
- */
40
- ctor: function () {
41
- cc.ParticleSystem.prototype.ctor.call(this, (cc._renderType === cc.game.RENDER_TYPE_WEBGL) ? 300 : 150);
42
- },
43
- /**
44
- * initialize a fire particle system with number Of Particles
45
- * @param {Number} numberOfParticles
46
- * @return {Boolean}
47
- */
48
- initWithTotalParticles: function (numberOfParticles) {
49
- if (cc.ParticleSystem.prototype.initWithTotalParticles.call(this, numberOfParticles)) {
50
- // duration
51
- this.setDuration(cc.ParticleSystem.DURATION_INFINITY);
52
- // Gravity Mode
53
- this.setEmitterMode(cc.ParticleSystem.MODE_GRAVITY);
54
- // Gravity Mode: gravity
55
- this.setGravity(cc.p(0, 0));
56
- // Gravity Mode: radial acceleration
57
- this.setRadialAccel(0);
58
- this.setRadialAccelVar(0);
59
- // Gravity Mode: speed of particles
60
- this.setSpeed(60);
61
- this.setSpeedVar(20);
62
- // starting angle
63
- this.setAngle(90);
64
- this.setAngleVar(10);
65
- // emitter position
66
- var winSize = cc.director.getWinSize();
67
- this.setPosition(winSize.width / 2, 60);
68
- this.setPosVar(cc.p(40, 20));
69
- // life of particles
70
- this.setLife(3);
71
- this.setLifeVar(0.25);
72
- // size, in pixels
73
- this.setStartSize(54.0);
74
- this.setStartSizeVar(10.0);
75
- this.setEndSize(cc.ParticleSystem.START_SIZE_EQUAL_TO_END_SIZE);
76
- // emits per frame
77
- this.setEmissionRate(this.getTotalParticles() / this.getLife());
78
- // color of particles
79
- this.setStartColor(cc.color(194, 64, 31, 255));
80
- this.setStartColorVar(cc.color(0, 0, 0, 0));
81
- this.setEndColor(cc.color(0, 0, 0, 255));
82
- this.setEndColorVar(cc.color(0, 0, 0, 0));
83
- // additive
84
- this.setBlendAdditive(true);
85
- return true;
86
- }
87
- return false;
88
- }
89
- });
90
- /**
91
- * Create a fire particle system
92
- * @deprecated since v3.0 please use new cc.ParticleFire() instead
93
- * @return {cc.ParticleFire}
94
- */
95
- cc.ParticleFire.create = function () {
96
- return new cc.ParticleFire();
97
- };
98
- /**
99
- * A fireworks particle system
100
- * @class
101
- * @extends cc.ParticleSystem
102
- *
103
- * @example
104
- * var emitter = new cc.ParticleFireworks();
105
- */
106
- cc.ParticleFireworks = cc.ParticleSystem.extend(/** @lends cc.ParticleFireworks# */ {
107
- /**
108
- * <p>The cc.ParticleFireworks's constructor. <br/>
109
- * This function will automatically be invoked when you create a node using new construction: "var node = new cc.ParticleFireworks()".<br/>
110
- * Override it to extend its behavior, remember to call "this._super()" in the extended "ctor" function.</p>
111
- */
112
- ctor: function () {
113
- cc.ParticleSystem.prototype.ctor.call(this, (cc._renderType === cc.game.RENDER_TYPE_WEBGL) ? 1500 : 150);
114
- },
115
- /**
116
- * initialize a fireworks particle system with number Of Particles
117
- * @param {Number} numberOfParticles
118
- * @return {Boolean}
119
- */
120
- initWithTotalParticles: function (numberOfParticles) {
121
- if (cc.ParticleSystem.prototype.initWithTotalParticles.call(this, numberOfParticles)) {
122
- // duration
123
- this.setDuration(cc.ParticleSystem.DURATION_INFINITY);
124
- // Gravity Mode
125
- this.setEmitterMode(cc.ParticleSystem.MODE_GRAVITY);
126
- // Gravity Mode: gravity
127
- this.setGravity(cc.p(0, -90));
128
- // Gravity Mode: radial
129
- this.setRadialAccel(0);
130
- this.setRadialAccelVar(0);
131
- // Gravity Mode: speed of particles
132
- this.setSpeed(180);
133
- this.setSpeedVar(50);
134
- // emitter position
135
- var winSize = cc.director.getWinSize();
136
- this.setPosition(winSize.width / 2, winSize.height / 2);
137
- // angle
138
- this.setAngle(90);
139
- this.setAngleVar(20);
140
- // life of particles
141
- this.setLife(3.5);
142
- this.setLifeVar(1);
143
- // emits per frame
144
- this.setEmissionRate(this.getTotalParticles() / this.getLife());
145
- // color of particles
146
- this.setStartColor(cc.color(128, 128, 128, 255));
147
- this.setStartColorVar(cc.color(128, 128, 128, 255));
148
- this.setEndColor(cc.color(26, 26, 26, 51));
149
- this.setEndColorVar(cc.color(26, 26, 26, 51));
150
- // size, in pixels
151
- this.setStartSize(8.0);
152
- this.setStartSizeVar(2.0);
153
- this.setEndSize(cc.ParticleSystem.START_SIZE_EQUAL_TO_END_SIZE);
154
- // additive
155
- this.setBlendAdditive(false);
156
- return true;
157
- }
158
- return false;
159
- }
160
- });
161
- /**
162
- * Create a fireworks particle system
163
- * @deprecated since v3.0 please use new cc.ParticleFireworks() instead.
164
- * @return {cc.ParticleFireworks}
165
- */
166
- cc.ParticleFireworks.create = function () {
167
- return new cc.ParticleFireworks();
168
- };
169
- /**
170
- * A sun particle system
171
- * @class
172
- * @extends cc.ParticleSystem
173
- *
174
- * @example
175
- * var emitter = new cc.ParticleSun();
176
- */
177
- cc.ParticleSun = cc.ParticleSystem.extend(/** @lends cc.ParticleSun# */ {
178
- /**
179
- * <p>The cc.ParticleSun's constructor. <br/>
180
- * This function will automatically be invoked when you create a node using new construction: "var node = new cc.ParticleSun()".<br/>
181
- * Override it to extend its behavior, remember to call "this._super()" in the extended "ctor" function.</p>
182
- */
183
- ctor: function () {
184
- cc.ParticleSystem.prototype.ctor.call(this, (cc._renderType === cc.game.RENDER_TYPE_WEBGL) ? 350 : 150);
185
- },
186
- /**
187
- * initialize a sun particle system with number Of Particles
188
- * @param {Number} numberOfParticles
189
- * @return {Boolean}
190
- */
191
- initWithTotalParticles: function (numberOfParticles) {
192
- if (cc.ParticleSystem.prototype.initWithTotalParticles.call(this, numberOfParticles)) {
193
- // additive
194
- this.setBlendAdditive(true);
195
- // duration
196
- this.setDuration(cc.ParticleSystem.DURATION_INFINITY);
197
- // Gravity Mode
198
- this.setEmitterMode(cc.ParticleSystem.MODE_GRAVITY);
199
- // Gravity Mode: gravity
200
- this.setGravity(cc.p(0, 0));
201
- // Gravity mode: radial acceleration
202
- this.setRadialAccel(0);
203
- this.setRadialAccelVar(0);
204
- // Gravity mode: speed of particles
205
- this.setSpeed(20);
206
- this.setSpeedVar(5);
207
- // angle
208
- this.setAngle(90);
209
- this.setAngleVar(360);
210
- // emitter position
211
- var winSize = cc.director.getWinSize();
212
- this.setPosition(winSize.width / 2, winSize.height / 2);
213
- this.setPosVar(cc.p(0, 0));
214
- // life of particles
215
- this.setLife(1);
216
- this.setLifeVar(0.5);
217
- // size, in pixels
218
- this.setStartSize(30.0);
219
- this.setStartSizeVar(10.0);
220
- this.setEndSize(cc.ParticleSystem.START_SIZE_EQUAL_TO_END_SIZE);
221
- // emits per seconds
222
- this.setEmissionRate(this.getTotalParticles() / this.getLife());
223
- // color of particles
224
- this.setStartColor(cc.color(194, 64, 31, 255));
225
- this.setStartColorVar(cc.color(0, 0, 0, 0));
226
- this.setEndColor(cc.color(0, 0, 0, 255));
227
- this.setEndColorVar(cc.color(0, 0, 0, 0));
228
- return true;
229
- }
230
- return false;
231
- }
232
- });
233
- /**
234
- * Create a sun particle system
235
- * @deprecated since v3.0 please use new cc.ParticleSun() instead.
236
- * @return {cc.ParticleSun}
237
- */
238
- cc.ParticleSun.create = function () {
239
- return new cc.ParticleSun();
240
- };
241
- //! @brief A particle system
242
- /**
243
- * A galaxy particle system
244
- * @class
245
- * @extends cc.ParticleSystem
246
- *
247
- * @example
248
- * var emitter = new cc.ParticleGalaxy();
249
- */
250
- cc.ParticleGalaxy = cc.ParticleSystem.extend(/** @lends cc.ParticleGalaxy# */ {
251
- /**
252
- * <p>The cc.ParticleGalaxy's constructor. <br/>
253
- * This function will automatically be invoked when you create a node using new construction: "var node = new cc.ParticleGalaxy()".<br/>
254
- * Override it to extend its behavior, remember to call "this._super()" in the extended "ctor" function.</p>
255
- */
256
- ctor: function () {
257
- cc.ParticleSystem.prototype.ctor.call(this, (cc._renderType === cc.game.RENDER_TYPE_WEBGL) ? 200 : 100);
258
- },
259
- /**
260
- * initialize a galaxy particle system with number Of Particles
261
- * @param {Number} numberOfParticles
262
- * @return {Boolean}
263
- */
264
- initWithTotalParticles: function (numberOfParticles) {
265
- if (cc.ParticleSystem.prototype.initWithTotalParticles.call(this, numberOfParticles)) {
266
- // duration
267
- this.setDuration(cc.ParticleSystem.DURATION_INFINITY);
268
- // Gravity Mode
269
- this.setEmitterMode(cc.ParticleSystem.MODE_GRAVITY);
270
- // Gravity Mode: gravity
271
- this.setGravity(cc.p(0, 0));
272
- // Gravity Mode: speed of particles
273
- this.setSpeed(60);
274
- this.setSpeedVar(10);
275
- // Gravity Mode: radial
276
- this.setRadialAccel(-80);
277
- this.setRadialAccelVar(0);
278
- // Gravity Mode: tangential
279
- this.setTangentialAccel(80);
280
- this.setTangentialAccelVar(0);
281
- // angle
282
- this.setAngle(90);
283
- this.setAngleVar(360);
284
- // emitter position
285
- var winSize = cc.director.getWinSize();
286
- this.setPosition(winSize.width / 2, winSize.height / 2);
287
- this.setPosVar(cc.p(0, 0));
288
- // life of particles
289
- this.setLife(4);
290
- this.setLifeVar(1);
291
- // size, in pixels
292
- this.setStartSize(37.0);
293
- this.setStartSizeVar(10.0);
294
- this.setEndSize(cc.ParticleSystem.START_SIZE_EQUAL_TO_END_SIZE);
295
- // emits per second
296
- this.setEmissionRate(this.getTotalParticles() / this.getLife());
297
- // color of particles
298
- this.setStartColor(cc.color(31, 64, 194, 255));
299
- this.setStartColorVar(cc.color(0, 0, 0, 0));
300
- this.setEndColor(cc.color(0, 0, 0, 255));
301
- this.setEndColorVar(cc.color(0, 0, 0, 0));
302
- // additive
303
- this.setBlendAdditive(true);
304
- return true;
305
- }
306
- return false;
307
- }
308
- });
309
- /**
310
- * Create a galaxy particle system
311
- * @deprecated since v3.0 please use new cc.OarticleGalaxy() instead.
312
- * @return {cc.ParticleGalaxy}
313
- */
314
- cc.ParticleGalaxy.create = function () {
315
- return new cc.ParticleGalaxy();
316
- };
317
- /**
318
- * A flower particle system
319
- * @class
320
- * @extends cc.ParticleSystem
321
- *
322
- * @example
323
- * var emitter = new cc.ParticleFlower();
324
- */
325
- cc.ParticleFlower = cc.ParticleSystem.extend(/** @lends cc.ParticleFlower# */ {
326
- /**
327
- * <p>The cc.ParticleFlower's constructor. <br/>
328
- * This function will automatically be invoked when you create a node using new construction: "var node = new cc.ParticleFlower()".<br/>
329
- * Override it to extend its behavior, remember to call "this._super()" in the extended "ctor" function.</p>
330
- */
331
- ctor: function () {
332
- cc.ParticleSystem.prototype.ctor.call(this, (cc._renderType === cc.game.RENDER_TYPE_WEBGL) ? 250 : 100);
333
- },
334
- /**
335
- * initialize a flower particle system with number Of Particles
336
- * @param {Number} numberOfParticles
337
- * @return {Boolean}
338
- */
339
- initWithTotalParticles: function (numberOfParticles) {
340
- if (cc.ParticleSystem.prototype.initWithTotalParticles.call(this, numberOfParticles)) {
341
- // duration
342
- this.setDuration(cc.ParticleSystem.DURATION_INFINITY);
343
- // Gravity Mode
344
- this.setEmitterMode(cc.ParticleSystem.MODE_GRAVITY);
345
- // Gravity Mode: gravity
346
- this.setGravity(cc.p(0, 0));
347
- // Gravity Mode: speed of particles
348
- this.setSpeed(80);
349
- this.setSpeedVar(10);
350
- // Gravity Mode: radial
351
- this.setRadialAccel(-60);
352
- this.setRadialAccelVar(0);
353
- // Gravity Mode: tangential
354
- this.setTangentialAccel(15);
355
- this.setTangentialAccelVar(0);
356
- // angle
357
- this.setAngle(90);
358
- this.setAngleVar(360);
359
- // emitter position
360
- var winSize = cc.director.getWinSize();
361
- this.setPosition(winSize.width / 2, winSize.height / 2);
362
- this.setPosVar(cc.p(0, 0));
363
- // life of particles
364
- this.setLife(4);
365
- this.setLifeVar(1);
366
- // size, in pixels
367
- this.setStartSize(30.0);
368
- this.setStartSizeVar(10.0);
369
- this.setEndSize(cc.ParticleSystem.START_SIZE_EQUAL_TO_END_SIZE);
370
- // emits per second
371
- this.setEmissionRate(this.getTotalParticles() / this.getLife());
372
- // color of particles
373
- this.setStartColor(cc.color(128, 128, 128, 255));
374
- this.setStartColorVar(cc.color(128, 128, 128, 128));
375
- this.setEndColor(cc.color(0, 0, 0, 255));
376
- this.setEndColorVar(cc.color(0, 0, 0, 0));
377
- // additive
378
- this.setBlendAdditive(true);
379
- return true;
380
- }
381
- return false;
382
- }
383
- });
384
- /**
385
- * Create a flower particle system
386
- * @deprecated since v3.0 please use new cc.ParticleFlower() instead.
387
- * @return {cc.ParticleFlower}
388
- */
389
- cc.ParticleFlower.create = function () {
390
- return new cc.ParticleFlower();
391
- };
392
- //! @brief A meteor particle system
393
- /**
394
- * A meteor particle system
395
- * @class
396
- * @extends cc.ParticleSystem
397
- *
398
- * @example
399
- * var emitter = new cc.ParticleMeteor();
400
- */
401
- cc.ParticleMeteor = cc.ParticleSystem.extend(/** @lends cc.ParticleMeteor# */ {
402
- /**
403
- * <p>The cc.ParticleMeteor's constructor. <br/>
404
- * This function will automatically be invoked when you create a node using new construction: "var node = new cc.ParticleMeteor()".<br/>
405
- * Override it to extend its behavior, remember to call "this._super()" in the extended "ctor" function.</p>
406
- */
407
- ctor: function () {
408
- cc.ParticleSystem.prototype.ctor.call(this, (cc._renderType === cc.game.RENDER_TYPE_WEBGL) ? 150 : 100);
409
- },
410
- /**
411
- * initialize a meteor particle system with number Of Particles
412
- * @param {Number} numberOfParticles
413
- * @return {Boolean}
414
- */
415
- initWithTotalParticles: function (numberOfParticles) {
416
- if (cc.ParticleSystem.prototype.initWithTotalParticles.call(this, numberOfParticles)) {
417
- // duration
418
- this.setDuration(cc.ParticleSystem.DURATION_INFINITY);
419
- // Gravity Mode
420
- this.setEmitterMode(cc.ParticleSystem.MODE_GRAVITY);
421
- // Gravity Mode: gravity
422
- this.setGravity(cc.p(-200, 200));
423
- // Gravity Mode: speed of particles
424
- this.setSpeed(15);
425
- this.setSpeedVar(5);
426
- // Gravity Mode: radial
427
- this.setRadialAccel(0);
428
- this.setRadialAccelVar(0);
429
- // Gravity Mode: tangential
430
- this.setTangentialAccel(0);
431
- this.setTangentialAccelVar(0);
432
- // angle
433
- this.setAngle(90);
434
- this.setAngleVar(360);
435
- // emitter position
436
- var winSize = cc.director.getWinSize();
437
- this.setPosition(winSize.width / 2, winSize.height / 2);
438
- this.setPosVar(cc.p(0, 0));
439
- // life of particles
440
- this.setLife(2);
441
- this.setLifeVar(1);
442
- // size, in pixels
443
- this.setStartSize(60.0);
444
- this.setStartSizeVar(10.0);
445
- this.setEndSize(cc.ParticleSystem.START_SIZE_EQUAL_TO_END_SIZE);
446
- // emits per second
447
- this.setEmissionRate(this.getTotalParticles() / this.getLife());
448
- // color of particles
449
- this.setStartColor(cc.color(51, 102, 179));
450
- this.setStartColorVar(cc.color(0, 0, 51, 26));
451
- this.setEndColor(cc.color(0, 0, 0, 255));
452
- this.setEndColorVar(cc.color(0, 0, 0, 0));
453
- // additive
454
- this.setBlendAdditive(true);
455
- return true;
456
- }
457
- return false;
458
- }
459
- });
460
- /**
461
- * Create a meteor particle system
462
- * @deprecated since v3.0 please use new cc.ParticleMeteor() instead.
463
- * @return {cc.ParticleMeteor}
464
- */
465
- cc.ParticleMeteor.create = function () {
466
- return new cc.ParticleMeteor();
467
- };
468
- /**
469
- * A spiral particle system
470
- * @class
471
- * @extends cc.ParticleSystem
472
- *
473
- * @example
474
- * var emitter = new cc.ParticleSpiral();
475
- */
476
- cc.ParticleSpiral = cc.ParticleSystem.extend(/** @lends cc.ParticleSpiral# */ {
477
- /**
478
- * <p>The cc.ParticleSpiral's constructor. <br/>
479
- * This function will automatically be invoked when you create a node using new construction: "var node = new cc.ParticleSpiral()".<br/>
480
- * Override it to extend its behavior, remember to call "this._super()" in the extended "ctor" function.</p>
481
- */
482
- ctor: function () {
483
- cc.ParticleSystem.prototype.ctor.call(this, (cc._renderType === cc.game.RENDER_TYPE_WEBGL) ? 500 : 100);
484
- },
485
- /**
486
- * initialize a spiral particle system with number Of Particles
487
- * @param {Number} numberOfParticles
488
- * @return {Boolean}
489
- */
490
- initWithTotalParticles: function (numberOfParticles) {
491
- if (cc.ParticleSystem.prototype.initWithTotalParticles.call(this, numberOfParticles)) {
492
- // duration
493
- this.setDuration(cc.ParticleSystem.DURATION_INFINITY);
494
- // Gravity Mode
495
- this.setEmitterMode(cc.ParticleSystem.MODE_GRAVITY);
496
- // Gravity Mode: gravity
497
- this.setGravity(cc.p(0, 0));
498
- // Gravity Mode: speed of particles
499
- this.setSpeed(150);
500
- this.setSpeedVar(0);
501
- // Gravity Mode: radial
502
- this.setRadialAccel(-380);
503
- this.setRadialAccelVar(0);
504
- // Gravity Mode: tangential
505
- this.setTangentialAccel(45);
506
- this.setTangentialAccelVar(0);
507
- // angle
508
- this.setAngle(90);
509
- this.setAngleVar(0);
510
- // emitter position
511
- var winSize = cc.director.getWinSize();
512
- this.setPosition(winSize.width / 2, winSize.height / 2);
513
- this.setPosVar(cc.p(0, 0));
514
- // life of particles
515
- this.setLife(12);
516
- this.setLifeVar(0);
517
- // size, in pixels
518
- this.setStartSize(20.0);
519
- this.setStartSizeVar(0.0);
520
- this.setEndSize(cc.ParticleSystem.START_SIZE_EQUAL_TO_END_SIZE);
521
- // emits per second
522
- this.setEmissionRate(this.getTotalParticles() / this.getLife());
523
- // color of particles
524
- this.setStartColor(cc.color(128, 128, 128, 255));
525
- this.setStartColorVar(cc.color(128, 128, 128, 0));
526
- this.setEndColor(cc.color(128, 128, 128, 255));
527
- this.setEndColorVar(cc.color(128, 128, 128, 0));
528
- // additive
529
- this.setBlendAdditive(false);
530
- return true;
531
- }
532
- return false;
533
- }
534
- });
535
- /**
536
- * Create a spiral particle system
537
- * @deprecated since v3.0 please use new cc.ParticleSpiral() instead.
538
- * @return {cc.ParticleSpiral}
539
- */
540
- cc.ParticleSpiral.create = function () {
541
- return new cc.ParticleSpiral();
542
- };
543
- /**
544
- * An explosion particle system
545
- * @class
546
- * @extends cc.ParticleSystem
547
- *
548
- * @example
549
- * var emitter = new cc.ParticleExplosion();
550
- */
551
- cc.ParticleExplosion = cc.ParticleSystem.extend(/** @lends cc.ParticleExplosion# */ {
552
- /**
553
- * <p>The cc.ParticleExplosion's constructor. <br/>
554
- * This function will automatically be invoked when you create a node using new construction: "var node = new cc.ParticleExplosion()".<br/>
555
- * Override it to extend its behavior, remember to call "this._super()" in the extended "ctor" function.</p>
556
- */
557
- ctor: function () {
558
- cc.ParticleSystem.prototype.ctor.call(this, (cc._renderType === cc.game.RENDER_TYPE_WEBGL) ? 700 : 300);
559
- },
560
- /**
561
- * initialize an explosion particle system with number Of Particles
562
- * @param {Number} numberOfParticles
563
- * @return {Boolean}
564
- */
565
- initWithTotalParticles: function (numberOfParticles) {
566
- if (cc.ParticleSystem.prototype.initWithTotalParticles.call(this, numberOfParticles)) {
567
- // duration
568
- this.setDuration(0.1);
569
- this.setEmitterMode(cc.ParticleSystem.MODE_GRAVITY);
570
- // Gravity Mode: gravity
571
- this.setGravity(cc.p(0, 0));
572
- // Gravity Mode: speed of particles
573
- this.setSpeed(70);
574
- this.setSpeedVar(40);
575
- // Gravity Mode: radial
576
- this.setRadialAccel(0);
577
- this.setRadialAccelVar(0);
578
- // Gravity Mode: tangential
579
- this.setTangentialAccel(0);
580
- this.setTangentialAccelVar(0);
581
- // angle
582
- this.setAngle(90);
583
- this.setAngleVar(360);
584
- // emitter position
585
- var winSize = cc.director.getWinSize();
586
- this.setPosition(winSize.width / 2, winSize.height / 2);
587
- this.setPosVar(cc.p(0, 0));
588
- // life of particles
589
- this.setLife(5.0);
590
- this.setLifeVar(2);
591
- // size, in pixels
592
- this.setStartSize(15.0);
593
- this.setStartSizeVar(10.0);
594
- this.setEndSize(cc.ParticleSystem.START_SIZE_EQUAL_TO_END_SIZE);
595
- // emits per second
596
- this.setEmissionRate(this.getTotalParticles() / this.getDuration());
597
- // color of particles
598
- this.setStartColor(cc.color(179, 26, 51, 255));
599
- this.setStartColorVar(cc.color(128, 128, 128, 0));
600
- this.setEndColor(cc.color(128, 128, 128, 0));
601
- this.setEndColorVar(cc.color(128, 128, 128, 0));
602
- // additive
603
- this.setBlendAdditive(false);
604
- return true;
605
- }
606
- return false;
607
- }
608
- });
609
- /**
610
- * Create an explosion particle system
611
- * @deprecated since v3.0 please use new cc.ParticleExplosion() instead.
612
- * @return {cc.ParticleExplosion}
613
- */
614
- cc.ParticleExplosion.create = function () {
615
- return new cc.ParticleExplosion();
616
- };
617
- /**
618
- * A smoke particle system
619
- * @class
620
- * @extends cc.ParticleSystem
621
- *
622
- * @example
623
- * var emitter = new cc.ParticleSmoke();
624
- */
625
- cc.ParticleSmoke = cc.ParticleSystem.extend(/** @lends cc.ParticleSmoke# */ {
626
- /**
627
- * <p>The cc.ParticleSmoke's constructor. <br/>
628
- * This function will automatically be invoked when you create a node using new construction: "var node = new cc.ParticleSmoke()".<br/>
629
- * Override it to extend its behavior, remember to call "this._super()" in the extended "ctor" function.</p>
630
- */
631
- ctor: function () {
632
- cc.ParticleSystem.prototype.ctor.call(this, (cc._renderType === cc.game.RENDER_TYPE_WEBGL) ? 200 : 100);
633
- },
634
- /**
635
- * initialize a smoke particle system with number Of Particles
636
- * @param {Number} numberOfParticles
637
- * @return {Boolean}
638
- */
639
- initWithTotalParticles: function (numberOfParticles) {
640
- if (cc.ParticleSystem.prototype.initWithTotalParticles.call(this, numberOfParticles)) {
641
- // duration
642
- this.setDuration(cc.ParticleSystem.DURATION_INFINITY);
643
- // Emitter mode: Gravity Mode
644
- this.setEmitterMode(cc.ParticleSystem.MODE_GRAVITY);
645
- // Gravity Mode: gravity
646
- this.setGravity(cc.p(0, 0));
647
- // Gravity Mode: radial acceleration
648
- this.setRadialAccel(0);
649
- this.setRadialAccelVar(0);
650
- // Gravity Mode: speed of particles
651
- this.setSpeed(25);
652
- this.setSpeedVar(10);
653
- // angle
654
- this.setAngle(90);
655
- this.setAngleVar(5);
656
- // emitter position
657
- var winSize = cc.director.getWinSize();
658
- this.setPosition(winSize.width / 2, 0);
659
- this.setPosVar(cc.p(20, 0));
660
- // life of particles
661
- this.setLife(4);
662
- this.setLifeVar(1);
663
- // size, in pixels
664
- this.setStartSize(60.0);
665
- this.setStartSizeVar(10.0);
666
- this.setEndSize(cc.ParticleSystem.START_SIZE_EQUAL_TO_END_SIZE);
667
- // emits per frame
668
- this.setEmissionRate(this.getTotalParticles() / this.getLife());
669
- // color of particles
670
- this.setStartColor(cc.color(204, 204, 204, 255));
671
- this.setStartColorVar(cc.color(5, 5, 5, 0));
672
- this.setEndColor(cc.color(0, 0, 0, 255));
673
- this.setEndColorVar(cc.color(0, 0, 0, 0));
674
- // additive
675
- this.setBlendAdditive(false);
676
- return true;
677
- }
678
- return false;
679
- }
680
- });
681
- /**
682
- * Create a smoke particle system
683
- * @deprecated since v3.0 please use new cc.ParticleSmoke() instead.
684
- * @return {cc.ParticleSmoke}
685
- */
686
- cc.ParticleSmoke.create = function () {
687
- return new cc.ParticleSmoke();
688
- };
689
- /**
690
- * A snow particle system
691
- * @class
692
- * @extends cc.ParticleSystem
693
- *
694
- * @example
695
- * var emitter = new cc.ParticleSnow();
696
- */
697
- cc.ParticleSnow = cc.ParticleSystem.extend(/** @lends cc.ParticleSnow# */ {
698
- /**
699
- * <p>The cc.ParticleSnow's constructor. <br/>
700
- * This function will automatically be invoked when you create a node using new construction: "var node = new cc.ParticleSnow()".<br/>
701
- * Override it to extend its behavior, remember to call "this._super()" in the extended "ctor" function.</p>
702
- */
703
- ctor: function () {
704
- cc.ParticleSystem.prototype.ctor.call(this, (cc._renderType === cc.game.RENDER_TYPE_WEBGL) ? 700 : 250);
705
- },
706
- /**
707
- * initialize a snow particle system with number Of Particles
708
- * @param {Number} numberOfParticles
709
- * @return {Boolean}
710
- */
711
- initWithTotalParticles: function (numberOfParticles) {
712
- if (cc.ParticleSystem.prototype.initWithTotalParticles.call(this, numberOfParticles)) {
713
- // duration
714
- this.setDuration(cc.ParticleSystem.DURATION_INFINITY);
715
- // set gravity mode.
716
- this.setEmitterMode(cc.ParticleSystem.MODE_GRAVITY);
717
- // Gravity Mode: gravity
718
- this.setGravity(cc.p(0, -1));
719
- // Gravity Mode: speed of particles
720
- this.setSpeed(5);
721
- this.setSpeedVar(1);
722
- // Gravity Mode: radial
723
- this.setRadialAccel(0);
724
- this.setRadialAccelVar(1);
725
- // Gravity mode: tangential
726
- this.setTangentialAccel(0);
727
- this.setTangentialAccelVar(1);
728
- // emitter position
729
- var winSize = cc.director.getWinSize();
730
- this.setPosition(winSize.width / 2, winSize.height + 10);
731
- this.setPosVar(cc.p(winSize.width / 2, 0));
732
- // angle
733
- this.setAngle(-90);
734
- this.setAngleVar(5);
735
- // life of particles
736
- this.setLife(45);
737
- this.setLifeVar(15);
738
- // size, in pixels
739
- this.setStartSize(10.0);
740
- this.setStartSizeVar(5.0);
741
- this.setEndSize(cc.ParticleSystem.START_SIZE_EQUAL_TO_END_SIZE);
742
- // emits per second
743
- this.setEmissionRate(10);
744
- // color of particles
745
- this.setStartColor(cc.color(255, 255, 255, 255));
746
- this.setStartColorVar(cc.color(0, 0, 0, 0));
747
- this.setEndColor(cc.color(255, 255, 255, 0));
748
- this.setEndColorVar(cc.color(0, 0, 0, 0));
749
- // additive
750
- this.setBlendAdditive(false);
751
- return true;
752
- }
753
- return false;
754
- }
755
- });
756
- /**
757
- * Create a snow particle system
758
- * @deprecated since v3.0 please use new cc.ParticleSnow() instead.
759
- * @return {cc.ParticleSnow}
760
- */
761
- cc.ParticleSnow.create = function () {
762
- return new cc.ParticleSnow();
763
- };
764
- //! @brief A rain particle system
765
- /**
766
- * A rain particle system
767
- * @class
768
- * @extends cc.ParticleSystem
769
- *
770
- * @example
771
- * var emitter = new cc.ParticleRain();
772
- */
773
- cc.ParticleRain = cc.ParticleSystem.extend(/** @lends cc.ParticleRain# */ {
774
- /**
775
- * <p>The cc.ParticleRain's constructor. <br/>
776
- * This function will automatically be invoked when you create a node using new construction: "var node = new cc.ParticleRain()".<br/>
777
- * Override it to extend its behavior, remember to call "this._super()" in the extended "ctor" function.</p>
778
- */
779
- ctor: function () {
780
- cc.ParticleSystem.prototype.ctor.call(this, (cc._renderType === cc.game.RENDER_TYPE_WEBGL) ? 1000 : 300);
781
- },
782
- /**
783
- * initialize a rain particle system with number Of Particles
784
- * @param {Number} numberOfParticles
785
- * @return {Boolean}
786
- */
787
- initWithTotalParticles: function (numberOfParticles) {
788
- if (cc.ParticleSystem.prototype.initWithTotalParticles.call(this, numberOfParticles)) {
789
- // duration
790
- this.setDuration(cc.ParticleSystem.DURATION_INFINITY);
791
- this.setEmitterMode(cc.ParticleSystem.MODE_GRAVITY);
792
- // Gravity Mode: gravity
793
- this.setGravity(cc.p(10, -10));
794
- // Gravity Mode: radial
795
- this.setRadialAccel(0);
796
- this.setRadialAccelVar(1);
797
- // Gravity Mode: tangential
798
- this.setTangentialAccel(0);
799
- this.setTangentialAccelVar(1);
800
- // Gravity Mode: speed of particles
801
- this.setSpeed(130);
802
- this.setSpeedVar(30);
803
- // angle
804
- this.setAngle(-90);
805
- this.setAngleVar(5);
806
- // emitter position
807
- var winSize = cc.director.getWinSize();
808
- this.setPosition(winSize.width / 2, winSize.height);
809
- this.setPosVar(cc.p(winSize.width / 2, 0));
810
- // life of particles
811
- this.setLife(4.5);
812
- this.setLifeVar(0);
813
- // size, in pixels
814
- this.setStartSize(4.0);
815
- this.setStartSizeVar(2.0);
816
- this.setEndSize(cc.ParticleSystem.START_SIZE_EQUAL_TO_END_SIZE);
817
- // emits per second
818
- this.setEmissionRate(20);
819
- // color of particles
820
- this.setStartColor(cc.color(179, 204, 255, 255));
821
- this.setStartColorVar(cc.color(0, 0, 0, 0));
822
- this.setEndColor(cc.color(179, 204, 255, 128));
823
- this.setEndColorVar(cc.color(0, 0, 0, 0));
824
- // additive
825
- this.setBlendAdditive(false);
826
- return true;
827
- }
828
- return false;
829
- }
830
- });
831
- /**
832
- * Create a rain particle system
833
- * @deprecated since v3.0 please use cc.ParticleRain() instead.
834
- * @return {cc.ParticleRain}
835
- */
836
- cc.ParticleRain.create = function () {
837
- return new cc.ParticleRain();
838
- };
839
- export {};