/
JsExtension.js
1314 lines (1276 loc) · 45.2 KB
/
JsExtension.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
//@ts-check
/// <reference path="../JsExtensionTypes.d.ts" />
/**
* This is a declaration of an extension for GDevelop 5.
*
* ℹ️ Changes in this file are watched and automatically imported if the editor
* is running. You can also manually run `node import-GDJS-Runtime.js` (in newIDE/app/scripts).
*
* The file must be named "JsExtension.js", otherwise GDevelop won't load it.
* ⚠️ If you make a change and the extension is not loaded, open the developer console
* and search for any errors.
*
* More information on https://github.com/4ian/GDevelop/blob/master/newIDE/README-extensions.md
*/
/** @type {ExtensionModule} */
module.exports = {
createExtension: function (_, gd) {
const extension = new gd.PlatformExtension();
extension
.setExtensionInformation(
'Effects',
'Effects',
'Lots of different effects to be used in your game.',
'Various contributors from PixiJS, PixiJS filters and GDevelop',
'MIT'
)
.setCategory('Visual effect')
.setExtensionHelpPath('/interface/scene-editor/layer-effects');
// ℹ️ You can declare an effect here. Please order the effects by alphabetical order.
// This file is for common effects that are well-known/"battle-tested". If you have an
// experimental effect, create an extension for it (copy this folder, rename "Effects" to something else,
// and remove all the files and declaration of effects, or take a look at ExampleJsExtension).
const adjustmentEffect = extension
.addEffect('Adjustment')
.setFullName(_('Adjustment'))
.setDescription(
_(
'Adjust gamma, contrast, saturation, brightness, alpha or color-channel shift.'
)
)
.markAsOnlyWorkingFor2D()
.addIncludeFile('Extensions/Effects/pixi-filters/filter-adjustment.js')
.addIncludeFile('Extensions/Effects/adjustment-pixi-filter.js');
const adjustmentProperties = adjustmentEffect.getProperties();
adjustmentProperties
.getOrCreate('gamma')
.setValue('1')
.setLabel(_('Gamma (between 0 and 5)'))
.setType('number');
adjustmentProperties
.getOrCreate('saturation')
.setValue('2')
.setLabel(_('Saturation (between 0 and 5)'))
.setType('number');
adjustmentProperties
.getOrCreate('contrast')
.setValue('1')
.setLabel(_('Contrast (between 0 and 5)'))
.setType('number');
adjustmentProperties
.getOrCreate('brightness')
.setValue('1')
.setLabel(_('Brightness (between 0 and 5)'))
.setType('number');
adjustmentProperties
.getOrCreate('red')
.setValue('1')
.setLabel(_('Red (between 0 and 5)'))
.setType('number');
adjustmentProperties
.getOrCreate('green')
.setValue('1')
.setLabel(_('Green (between 0 and 5)'))
.setType('number');
adjustmentProperties
.getOrCreate('blue')
.setValue('0.6')
.setLabel(_('Blue (between 0 and 5)'))
.setType('number');
adjustmentProperties
.getOrCreate('alpha')
.setValue('1')
.setLabel(_('Alpha (between 0 and 1, 0 is transparent)'))
.setType('number');
const advancedBloomEffect = extension
.addEffect('AdvancedBloom')
.setFullName(_('Advanced bloom'))
.setDescription(_('Applies a bloom effect.'))
.markAsOnlyWorkingFor2D()
.addIncludeFile('Extensions/Effects/pixi-filters/filter-kawase-blur.js')
.addIncludeFile(
'Extensions/Effects/pixi-filters/filter-advanced-bloom.js'
)
.addIncludeFile('Extensions/Effects/advanced-bloom-pixi-filter.js');
const advancedBloomProperties = advancedBloomEffect.getProperties();
advancedBloomProperties
.getOrCreate('threshold')
.setValue('0.5')
.setLabel(_('Threshold (between 0 and 1)'))
.setType('number');
advancedBloomProperties
.getOrCreate('bloomScale')
.setValue('0.7')
.setLabel(_('Bloom Scale (between 0 and 2)'))
.setType('number');
advancedBloomProperties
.getOrCreate('brightness')
.setValue('0.7')
.setLabel(_('Brightness (between 0 and 2)'))
.setType('number');
advancedBloomProperties
.getOrCreate('blur')
.setValue('4')
.setLabel(_('Blur (between 0 and 20)'))
.setType('number');
advancedBloomProperties
.getOrCreate('quality')
.setValue('7')
.setLabel(_('Quality (between 0 and 20)'))
.setType('number');
advancedBloomProperties
.getOrCreate('padding')
.setValue('0')
.setLabel(_('Padding'))
.setType('number')
.setDescription(_('Padding for the visual effect area'));
const asciiEffect = extension
.addEffect('Ascii')
.setFullName(_('ASCII'))
.setDescription(_('Render the image with ASCII characters only.'))
.markAsOnlyWorkingFor2D()
.addIncludeFile('Extensions/Effects/pixi-filters/filter-ascii.js')
.addIncludeFile('Extensions/Effects/ascii-pixi-filter.js');
const asciiProperties = asciiEffect.getProperties();
asciiProperties
.getOrCreate('size')
.setValue('8')
.setLabel(_('Size (between 2 and 20)'))
.setType('number');
const bevelEffect = extension
.addEffect('Bevel')
.setFullName(_('Beveled edges'))
.setDescription(_('Add beveled edges around the rendered image.'))
.markAsOnlyWorkingFor2D()
.addIncludeFile('Extensions/Effects/pixi-filters/filter-bevel.js')
.addIncludeFile('Extensions/Effects/bevel-pixi-filter.js');
const bevelProperties = bevelEffect.getProperties();
bevelProperties
.getOrCreate('rotation')
.setValue('1')
.setLabel(_('Rotation (between 0 and 360)'))
.setType('number');
bevelProperties
.getOrCreate('thickness')
.setValue('2')
.setLabel(_('Outer strength (between 0 and 5)'))
.setType('number');
bevelProperties
.getOrCreate('distance')
.setValue('15')
.setLabel(_('Distance (between 10 and 20)'))
.setType('number');
bevelProperties
.getOrCreate('lightAlpha')
.setValue('1')
.setLabel(_('Light alpha (between 0 and 1)'))
.setType('number');
bevelProperties
.getOrCreate('lightColor')
.setValue('255;255;255')
.setLabel(_('Light color (color of the outline)'))
.setType('color');
bevelProperties
.getOrCreate('shadowColor')
.setValue('0;0;0')
.setLabel(_('Shadow color (color of the outline)'))
.setType('color');
bevelProperties
.getOrCreate('shadowAlpha')
.setValue('1')
.setLabel(_('Shadow alpha (between 0 and 1)'))
.setType('number');
const blackAndWhiteEffect = extension
.addEffect('BlackAndWhite')
.setFullName(_('Black and White'))
.setDescription(_('Alter the colors to make the image black and white'))
.markAsOnlyWorkingFor2D()
.addIncludeFile('Extensions/Effects/black-and-white-pixi-filter.js');
const blackAndWhiteProperties = blackAndWhiteEffect.getProperties();
blackAndWhiteProperties
.getOrCreate('opacity')
.setValue('1')
.setLabel(_('Opacity (between 0 and 1)'))
.setType('number');
const blendingModeEffect = extension
.addEffect('BlendingMode')
.setFullName(_('Blending mode'))
.setDescription(
_('Alter the rendered image with the specified blend mode.')
)
.markAsOnlyWorkingFor2D()
.addIncludeFile('Extensions/Effects/blending-mode-pixi-filter.js');
const blendingModeProperties = blendingModeEffect.getProperties();
blendingModeProperties
.getOrCreate('blendmode')
.setValue('0')
.setLabel(_('Mode (0: Normal, 1: Add, 2: Multiply, 3: Screen)'))
.setType('number');
blendingModeProperties
.getOrCreate('opacity')
.setValue('1')
.setLabel(_('Opacity (between 0 and 1)'))
.setType('number');
const blurEffect = extension
.addEffect('Blur')
.setFullName(_('Blur (Gaussian, slow - prefer to use Kawase blur)'))
.setDescription(
_(
'Blur the rendered image. This is slow, so prefer to use Kawase blur in most cases.'
)
)
.markAsOnlyWorkingFor2D()
.addIncludeFile('Extensions/Effects/blur-pixi-filter.js');
const blurProperties = blurEffect.getProperties();
blurProperties
.getOrCreate('blur')
.setValue('8')
.setLabel(_('Blur intensity'))
.setType('number');
blurProperties
.getOrCreate('quality')
.setValue('1')
.setLabel(
_(
'Number of render passes. An high value will cause lags/poor performance.'
)
)
.setType('number');
blurProperties
.getOrCreate('resolution')
.setValue('2')
.setLabel(_('Resolution'))
.setType('number');
blurProperties
.getOrCreate('kernelSize')
.setValue('5')
.setLabel(_('Kernel size (one of these values: 5, 7, 9, 11, 13, 15)'))
.setType('number');
const brightnessEffect = extension
.addEffect('Brightness')
.setFullName(_('Brightness'))
.setDescription(_('Make the image brighter.'))
.markAsOnlyWorkingFor2D()
.addIncludeFile('Extensions/Effects/brightness-pixi-filter.js');
const brightnessProperties = brightnessEffect.getProperties();
brightnessProperties
.getOrCreate('brightness')
.setValue('0.8')
.setLabel(_('Brightness (between 0 and 1)'))
.setType('number');
const bulgePinchEffect = extension
.addEffect('BulgePinch')
.setFullName(_('Bulge Pinch'))
.setDescription(_('Bulges or pinches the image in a circle.'))
.markAsOnlyWorkingFor2D()
.addIncludeFile('Extensions/Effects/pixi-filters/filter-bulge-pinch.js')
.addIncludeFile('Extensions/Effects/bulge-pinch-pixi-filter.js');
const bulgePinchProperties = bulgePinchEffect.getProperties();
bulgePinchProperties
.getOrCreate('centerX')
.setValue('0')
.setLabel(_('Center X (between 0 and 1, 0.5 is image middle)'))
.setType('number');
bulgePinchProperties
.getOrCreate('centerY')
.setValue('0')
.setLabel(_('Center Y (between 0 and 1, 0.5 is image middle)'))
.setType('number');
bulgePinchProperties
.getOrCreate('radius')
.setValue('100')
.setLabel(_('Radius'))
.setType('number');
bulgePinchProperties
.getOrCreate('strength')
.setValue('1')
.setLabel(_('strength (between -1 and 1)'))
.setType('number')
.setDescription(
_('-1 is strong pinch, 0 is no effect, 1 is strong bulge')
);
const colorMapEffect = extension
.addEffect('ColorMap')
.setFullName(_('Color Map'))
.setDescription(_('Change the color rendered on screen.'))
.markAsOnlyWorkingFor2D()
.addIncludeFile('Extensions/Effects/color-map-pixi-filter.js')
.addIncludeFile('Extensions/Effects/pixi-filters/filter-color-map.js');
const colorMapProperties = colorMapEffect.getProperties();
colorMapProperties
.getOrCreate('colorMapTexture')
.setType('resource')
.addExtraInfo('image')
.setLabel(_('Color map texture for the effect'))
.setDescription(
_(
'You can change colors of pixels by modifying a reference color image, containing each colors, called the *Color Map Texture*. To get started, **download** [a default color map texture here](https://wiki.gdevelop.io/gdevelop5/interface/scene-editor/layer-effects).'
)
);
colorMapProperties
.getOrCreate('nearest')
.setValue('false')
.setLabel(_('Disable anti-aliasing ("nearest" pixel rounding)'))
.setType('boolean');
colorMapProperties
.getOrCreate('mix')
.setValue('100')
.setLabel(_('Mix'))
.setType('number')
.setDescription(_('Mix value of the effect on the layer (in percent)'));
const colorReplaceEffect = extension
.addEffect('ColorReplace')
.setFullName(_('Color Replace'))
.setDescription(_('Effect replacing a color (or similar) by another.'))
.markAsOnlyWorkingFor2D()
.addIncludeFile('Extensions/Effects/pixi-filters/filter-color-replace.js')
.addIncludeFile('Extensions/Effects/color-replace-pixi-filter.js');
const colorReplaceProperties = colorReplaceEffect.getProperties();
colorReplaceProperties
.getOrCreate('originalColor')
.setValue('252;3;65')
.setLabel(_('Original Color'))
.setType('color')
.setDescription('The color that will be changed');
colorReplaceProperties
.getOrCreate('newColor')
.setValue('255;255;255')
.setLabel(_('New Color'))
.setType('color')
.setDescription('The new color');
colorReplaceProperties
.getOrCreate('epsilon')
.setValue('0.4')
.setLabel(_('Epsilon (between 0 and 1)'))
.setType('number')
.setDescription(
_(
'Tolerance/sensitivity of the floating-point comparison between colors (lower = more exact, higher = more inclusive)'
)
);
const crtEffect = extension
.addEffect('CRT')
.setFullName(_('CRT'))
.setDescription(_('Apply an effect resembling old CRT monitors.'))
.markAsOnlyWorkingFor2D()
.addIncludeFile('Extensions/Effects/pixi-filters/filter-crt.js')
.addIncludeFile('Extensions/Effects/crt-pixi-filter.js');
const crtProperties = crtEffect.getProperties();
crtProperties
.getOrCreate('lineWidth')
.setValue('1')
.setLabel(_('Line width (between 0 and 5)'))
.setType('number');
crtProperties
.getOrCreate('lineContrast')
.setValue('0.25')
.setLabel(_('Line contrast (between 0 and 1)'))
.setType('number');
crtProperties
.getOrCreate('noise')
.setValue('0.3')
.setLabel(_('Noise (between 0 and 1)'))
.setType('number');
crtProperties
.getOrCreate('curvature')
.setValue('1')
.setLabel(_('Curvature (between 0 and 10)'))
.setType('number');
crtProperties
.getOrCreate('verticalLine')
.setValue('false')
.setLabel(_('Show vertical lines'))
.setType('boolean');
crtProperties
.getOrCreate('noiseSize')
.setValue('1')
.setLabel(_('Noise size (between 0 and 10)'))
.setType('number');
crtProperties
.getOrCreate('vignetting')
.setValue('0.3')
.setLabel(_('Vignetting (between 0 and 1)'))
.setType('number');
crtProperties
.getOrCreate('vignettingAlpha')
.setValue('1')
.setLabel(_('Vignetting alpha (between 0 and 1)'))
.setType('number');
crtProperties
.getOrCreate('vignettingBlur')
.setValue('0.3')
.setLabel(_('Vignetting blur (between 0 and 1)'))
.setType('number');
crtProperties
.getOrCreate('animationSpeed')
.setValue('1')
.setLabel(_('Interlaced Lines Speed'))
.setType('number')
.setDescription(
_('0: Pause, 0.5: Half speed, 1: Normal speed, 2: Double speed, etc...')
);
crtProperties
.getOrCreate('animationFrequency')
.setValue('60')
.setLabel(_('Noise Frequency'))
.setType('number')
.setDescription('Number of updates per second (0: no updates)');
crtProperties
.getOrCreate('padding')
.setValue('0')
.setLabel(_('Padding'))
.setType('number')
.setDescription(_('Padding for the visual effect area'));
const displacementEffect = extension
.addEffect('Displacement')
.setFullName(_('Displacement'))
.setDescription(
_(
'Uses the pixel values from the specified texture (called the displacement map) to perform a displacement of an object.'
)
)
.markAsOnlyWorkingFor2D()
.addIncludeFile('Extensions/Effects/displacement-pixi-filter.js');
const displacementProperties = displacementEffect.getProperties();
displacementProperties
.getOrCreate('displacementMapTexture')
.setType('resource')
.addExtraInfo('image')
.setLabel(_('Displacement map texture'))
.setDescription(
_(
'Displacement map texture for the effect. To get started, **download** [a default displacement map texture here](https://wiki.gdevelop.io/gdevelop5/interface/scene-editor/layer-effects).'
)
);
displacementProperties
.getOrCreate('scaleX')
.setValue('20')
.setLabel(_('Scale on X axis'))
.setType('number');
displacementProperties
.getOrCreate('scaleY')
.setValue('20')
.setLabel(_('Scale on Y axis'))
.setType('number');
const dotEffect = extension
.addEffect('Dot')
.setFullName(_('Dot'))
.setDescription(
_(
'Applies a dotscreen effect making objects appear to be made out of black and white halftone dots like an old printer.'
)
)
.markAsOnlyWorkingFor2D()
.addIncludeFile('Extensions/Effects/pixi-filters/filter-dot.js')
.addIncludeFile('Extensions/Effects/dot-pixi-filter.js');
const dotProperties = dotEffect.getProperties();
dotProperties
.getOrCreate('scale')
.setValue('1')
.setLabel(_('Scale (between 0.3 and 1)'))
.setType('number')
.setDescription('The scale of the effect');
dotProperties
.getOrCreate('angle')
.setValue('5')
.setLabel(_('Angle (between 0 and 5)'))
.setType('number')
.setDescription('The radius of the effect');
const dropShadowEffect = extension
.addEffect('DropShadow')
.setFullName(_('Drop shadow'))
.setDescription(_('Add a shadow around the rendered image.'))
.markAsOnlyWorkingFor2D()
.addIncludeFile('Extensions/Effects/pixi-filters/filter-kawase-blur.js')
.addIncludeFile('Extensions/Effects/pixi-filters/filter-drop-shadow.js')
.addIncludeFile('Extensions/Effects/drop-shadow-pixi-filter.js');
const dropShadowProperties = dropShadowEffect.getProperties();
dropShadowProperties
.getOrCreate('blur')
.setValue('2')
.setLabel(_('Blur (between 0 and 20)'))
.setType('number');
dropShadowProperties
.getOrCreate('quality')
.setValue('3')
.setLabel(_('Quality (between 1 and 20)'))
.setType('number');
dropShadowProperties
.getOrCreate('alpha')
.setValue('1')
.setLabel(_('Alpha (between 0 and 1)'))
.setType('number');
dropShadowProperties
.getOrCreate('distance')
.setValue('1')
.setLabel(_('Distance (between 0 and 50)'))
.setType('number');
dropShadowProperties
.getOrCreate('rotation')
.setValue('0')
.setLabel(_('Rotation (between 0 and 360)'))
.setType('number');
dropShadowProperties
.getOrCreate('color')
.setValue('255;255;255')
.setLabel(_('Color of the shadow'))
.setType('color');
dropShadowProperties
.getOrCreate('shadowOnly')
.setValue('false')
.setLabel(_('Shadow only (shows only the shadow when enabled)'))
.setType('boolean');
dropShadowProperties
.getOrCreate('padding')
.setValue('0')
.setLabel(_('Padding'))
.setType('number')
.setDescription(_('Padding for the visual effect area'));
const glitchEffect = extension
.addEffect('Glitch')
.setFullName(_('Glitch'))
.setDescription(_('Applies a glitch effect to an object.'))
.markAsOnlyWorkingFor2D()
.addIncludeFile('Extensions/Effects/pixi-filters/filter-glitch.js')
.addIncludeFile('Extensions/Effects/glitch-pixi-filter.js');
const glitchProperties = glitchEffect.getProperties();
glitchProperties
.getOrCreate('slices')
.setValue('5')
.setLabel(_('Slices (between 2 and infinite)'))
.setType('number')
.setDescription('The maximum number of slices');
glitchProperties
.getOrCreate('offset')
.setValue('100')
.setLabel(_('Offset (between -400 and 400)'))
.setType('number')
.setDescription('The maximum offset amount of slices');
glitchProperties
.getOrCreate('direction')
.setValue('0')
.setLabel(_('Direction (between -180 and 180)'))
.setType('number')
.setDescription('The angle in degree of the offset of slices');
glitchProperties
.getOrCreate('fillMode')
.setValue('0')
.setLabel(_('Fill Mode (between 0 and 4)'))
.setType('number')
.setDescription(
_(
'The fill mode of the space after the offset.(0: TRANSPARENT, 1: ORIGINAL, 2: LOOP, 3: CLAMP, 4: MIRROR)'
)
);
glitchProperties
.getOrCreate('average')
.setValue('false')
.setLabel(_('Average'))
.setType('boolean')
.setDescription('Divide the bands roughly based on equal amounts');
glitchProperties
.getOrCreate('minSize')
.setValue('8')
.setLabel(_('Min Size'))
.setType('number')
.setDescription('Minimum size of individual slice');
glitchProperties
.getOrCreate('sampleSize')
.setValue('512')
.setLabel(_('Sample Size'))
.setType('number')
.setDescription('The resolution of the displacement image');
glitchProperties
.getOrCreate('animationFrequency')
.setValue('60')
.setLabel(_('Animation Frequency'))
.setType('number')
.setDescription('Number of updates per second (0: no updates)');
glitchProperties
.getOrCreate('redX')
.setValue('2')
.setLabel(_('Red X offset (between -50 and 50)'))
.setType('number');
glitchProperties
.getOrCreate('redY')
.setValue('2')
.setLabel(_('Red Y offset (between -50 and 50)'))
.setType('number');
glitchProperties
.getOrCreate('greenX')
.setValue('10')
.setLabel(_('Green X offset (between -50 and 50)'))
.setType('number');
glitchProperties
.getOrCreate('greenY')
.setValue('-4')
.setLabel(_('Green Y offset (between -50 and 50)'))
.setType('number');
glitchProperties
.getOrCreate('blueX')
.setValue('10')
.setLabel(_('Blue X offset (between -50 and 50)'))
.setType('number');
glitchProperties
.getOrCreate('blueY')
.setValue('-4')
.setLabel(_('Blue Y offset (between -50 and 50)'))
.setType('number');
const glowEffect = extension
.addEffect('Glow')
.setFullName(_('Glow'))
.setDescription(_('Add a glow effect around the rendered image.'))
.markAsOnlyWorkingFor2D()
.addIncludeFile('Extensions/Effects/pixi-filters/filter-glow.js')
.addIncludeFile('Extensions/Effects/glow-pixi-filter.js');
const glowProperties = glowEffect.getProperties();
glowProperties
.getOrCreate('innerStrength')
.setValue('1')
.setLabel(_('Inner strength (between 0 and 20)'))
.setType('number');
glowProperties
.getOrCreate('outerStrength')
.setValue('2')
.setLabel(_('Outer strength (between 0 and 20)'))
.setType('number');
glowProperties
.getOrCreate('distance')
.setValue('15')
.setLabel(_('Distance (between 10 and 20)'))
.setType('number');
glowProperties
.getOrCreate('color')
.setValue('255;255;255')
.setLabel(_('Color (color of the outline)'))
.setType('color');
const godrayEffect = extension
.addEffect('Godray')
.setFullName(_('Godray'))
.setDescription(_('Apply and animate atmospheric light rays.'))
.markAsOnlyWorkingFor2D()
.addIncludeFile('Extensions/Effects/pixi-filters/filter-godray.js')
.addIncludeFile('Extensions/Effects/godray-pixi-filter.js');
const godrayProperties = godrayEffect.getProperties();
godrayProperties
.getOrCreate('parallel')
.setValue('true')
.setLabel(_('Parallel (parallel rays)'))
.setType('boolean');
godrayProperties
.getOrCreate('animationSpeed')
.setValue('1')
.setLabel(_('Animation Speed'))
.setType('number')
.setDescription(
_('0: Pause, 0.5: Half speed, 1: Normal speed, 2: Double speed, etc...')
);
godrayProperties
.getOrCreate('lacunarity')
.setValue('2.75')
.setLabel(_('Lacunarity (between 0 and 5)'))
.setType('number');
godrayProperties
.getOrCreate('angle')
.setValue('30')
.setLabel(_('Angle (between -60 and 60)'))
.setType('number');
godrayProperties
.getOrCreate('gain')
.setValue('0.6')
.setLabel(_('Gain (between 0 and 1)'))
.setType('number');
godrayProperties
.getOrCreate('light')
.setValue('30')
.setLabel(_('Light (between 0 and 60)'))
.setType('number');
godrayProperties
.getOrCreate('x')
.setValue('100')
.setLabel(_('Center X (between 100 and 1000)'))
.setType('number');
godrayProperties
.getOrCreate('y')
.setValue('100')
.setLabel(_('Center Y (between -1000 and 100)'))
.setType('number');
godrayProperties
.getOrCreate('padding')
.setValue('0')
.setLabel(_('Padding'))
.setType('number')
.setDescription(_('Padding for the visual effect area'));
const hslAdjustmentEffect = extension
.addEffect('HslAdjustment')
.setFullName(_('HSL Adjustment'))
.setDescription(_('Adjust hue, saturation and lightness.'))
.markAsOnlyWorkingFor2D()
.addIncludeFile(
'Extensions/Effects/pixi-filters/filter-hsl-adjustment.js'
)
.addIncludeFile('Extensions/Effects/hsl-adjustment-pixi-filter.js');
const hslAdjustmentProperties = hslAdjustmentEffect.getProperties();
hslAdjustmentProperties
.getOrCreate('hue')
.setValue('0')
.setLabel(_('Hue in degrees (between -180 and 180)'))
.setType('number');
hslAdjustmentProperties
.getOrCreate('saturation')
.setValue('0')
.setLabel(_('Saturation (between -1 and 1)'))
.setType('number');
hslAdjustmentProperties
.getOrCreate('lightness')
.setValue('0')
.setLabel(_('Lightness (between -1 and 1)'))
.setType('number');
hslAdjustmentProperties
.getOrCreate('colorize')
.setValue('false')
.setLabel(_('Colorize from the grayscale image'))
.setType('boolean');
hslAdjustmentProperties
.getOrCreate('alpha')
.setValue('1')
.setLabel(_('Alpha (between 0 and 1, 0 is transparent)'))
.setType('number');
const kawaseBlurEffect = extension
.addEffect('KawaseBlur')
.setFullName(_('Blur (Kawase, fast)'))
.setDescription(
_(
'Blur the rendered image, with much better performance than Gaussian blur.'
)
)
.markAsOnlyWorkingFor2D()
.addIncludeFile('Extensions/Effects/pixi-filters/filter-kawase-blur.js')
.addIncludeFile('Extensions/Effects/kawase-blur-pixi-filter.js');
const kawaseBlurProperties = kawaseBlurEffect.getProperties();
kawaseBlurProperties
.getOrCreate('pixelizeX')
.setValue('1')
.setLabel(_('Pixelize X (between 0 and 10)'))
.setType('number');
kawaseBlurProperties
.getOrCreate('pixelizeY')
.setValue('1')
.setLabel(_('Pixelize Y (between 0 and 10)'))
.setType('number');
kawaseBlurProperties
.getOrCreate('blur')
.setValue('0.5')
.setLabel(_('Blur (between 0 and 20)'))
.setType('number');
kawaseBlurProperties
.getOrCreate('quality')
.setValue('3')
.setLabel(_('Quality (between 1 and 20)'))
.setType('number');
kawaseBlurProperties
.getOrCreate('padding')
.setValue('0')
.setLabel(_('Padding'))
.setType('number')
.setDescription(_('Padding for the visual effect area'));
const lightNightEffect = extension
.addEffect('LightNight')
.setFullName(_('Light Night'))
.setDescription(_('Alter the colors to simulate night.'))
.markAsOnlyWorkingFor2D()
.addIncludeFile('Extensions/Effects/light-night-pixi-filter.js');
const lightNightProperties = lightNightEffect.getProperties();
lightNightProperties
.getOrCreate('opacity')
.setValue('1')
.setLabel(_('Opacity (between 0 and 1)'))
.setType('number');
const motionBlurEffect = extension
.addEffect('MotionBlur')
.setFullName(_('Motion Blur'))
.setDescription(_('Blur the rendered image to give a feeling of speed.'))
.markAsOnlyWorkingFor2D()
.addIncludeFile('Extensions/Effects/pixi-filters/filter-motion-blur.js')
.addIncludeFile('Extensions/Effects/motion-blur-pixi-filter.js');
const motionBlurProperties = motionBlurEffect.getProperties();
motionBlurProperties
.getOrCreate('velocityX')
.setValue('0')
.setLabel(_('Velocity on X axis'))
.setType('number');
motionBlurProperties
.getOrCreate('velocityY')
.setValue('0')
.setLabel(_('Velocity on Y axis'))
.setType('number');
motionBlurProperties
.getOrCreate('kernelSize')
.setValue('5')
.setLabel(_('Kernel size (odd number between 3 and 25)'))
.setType('number')
.setDescription(_('Quality of the blur.'));
motionBlurProperties
.getOrCreate('offset')
.setValue('0')
.setLabel(_('Offset'))
.setType('number');
const nightEffect = extension
.addEffect('Night')
.setFullName(_('Dark Night'))
.setDescription(_('Alter the colors to simulate a dark night.'))
.markAsOnlyWorkingFor2D()
.addIncludeFile('Extensions/Effects/night-pixi-filter.js');
const nightProperties = nightEffect.getProperties();
nightProperties
.getOrCreate('intensity')
.setValue('0.5')
.setLabel(_('Intensity (between 0 and 1)'))
.setType('number');
nightProperties
.getOrCreate('opacity')
.setValue('0.5')
.setLabel(_('Opacity (between 0 and 1)'))
.setType('number');
const noiseEffect = extension
.addEffect('Noise')
.setFullName(_('Noise'))
.setDescription(_('Add some noise on the rendered image.'))
.markAsOnlyWorkingFor2D()
.addIncludeFile('Extensions/Effects/noise-pixi-filter.js');
const noiseProperties = noiseEffect.getProperties();
noiseProperties
.getOrCreate('noise')
.setValue('0.5')
.setLabel(_('Noise intensity (between 0 and 1)'))
.setType('number');
const oldFilmEffect = extension
.addEffect('OldFilm')
.setFullName(_('Old Film'))
.setDescription(_('Add a Old film effect around the rendered image.'))
.markAsOnlyWorkingFor2D()
.addIncludeFile('Extensions/Effects/pixi-filters/filter-old-film.js')
.addIncludeFile('Extensions/Effects/old-film-pixi-filter.js');
const oldFilmProperties = oldFilmEffect.getProperties();
oldFilmProperties
.getOrCreate('sepia')
.setValue('0.3')
.setLabel(_('Sepia (between 0 and 1)'))
.setType('number')
.setDescription(
_(
'The amount of saturation of sepia effect, a value of 1 is more saturation and closer to 0 is less, and a value of 0 produces no sepia effect'
)
);
oldFilmProperties
.getOrCreate('noise')
.setValue('0.3')
.setLabel(_('Noise (between 0 and 1)'))
.setType('number')
.setDescription('Opacity/intensity of the noise effect');
oldFilmProperties
.getOrCreate('noiseSize')
.setValue('1')
.setLabel(_('Noise Size (between 0 and 10)'))
.setType('number')
.setDescription('The size of the noise particles');
oldFilmProperties
.getOrCreate('scratch')
.setValue('0.5')
.setLabel(_('Scratch (between -1 and 1)'))
.setType('number')
.setDescription('How often scratches appear');
oldFilmProperties
.getOrCreate('scratchDensity')
.setValue('0.3')
.setLabel(_('Scratch Density (between 0 and 1)'))
.setType('number')
.setDescription('The density of the number of scratches');
oldFilmProperties
.getOrCreate('scratchWidth')
.setValue('1.0')
.setLabel(_('Scratch Width (between 1 and 20)'))
.setType('number')
.setDescription('The width of the scratches');
oldFilmProperties
.getOrCreate('vignetting')
.setValue('0.3')
.setLabel(_('Vignetting (between 0 and 1)'))
.setType('number')
.setDescription('The radius of the vignette effect');
oldFilmProperties
.getOrCreate('vignettingAlpha')
.setValue('1.0')
.setLabel(_('Vignetting Alpha (between 0 and 1)'))
.setType('number');
oldFilmProperties
.getOrCreate('vignettingBlur')
.setValue('0.3')
.setLabel(_('Vignetting Blur (between 0 and 1)'))
.setType('number');
oldFilmProperties
.getOrCreate('animationFrequency')
.setValue('60')
.setLabel(_('Animation Frequency'))
.setType('number')
.setDescription('Number of updates per second (0: no updates)');
const outlineEffect = extension
.addEffect('Outline')
.setFullName(_('Outline'))
.setDescription(_('Draws an outline around the rendered image.'))
.markAsOnlyWorkingFor2D()
.addIncludeFile('Extensions/Effects/pixi-filters/filter-outline.js')
.addIncludeFile('Extensions/Effects/outline-pixi-filter.js');
const outlineProperties = outlineEffect.getProperties();
outlineProperties
.getOrCreate('thickness')
.setValue('2')
.setLabel(_('Thickness (between 0 and 20)'))
.setType('number');
outlineProperties
.getOrCreate('color')
.setValue('255;255;255')
.setLabel(_('Color of the outline'))
.setType('color');
outlineProperties
.getOrCreate('padding')
.setValue('0')
.setLabel(_('Padding'))
.setType('number')
.setDescription(_('Padding for the visual effect area'));
const pixelateEffect = extension
.addEffect('Pixelate')
.setFullName(_('Pixelate'))
.setDescription(
_("Applies a pixelate effect, making display objects appear 'blocky'.")
)
.markAsOnlyWorkingFor2D()
.addIncludeFile('Extensions/Effects/pixi-filters/filter-pixelate.js')
.addIncludeFile('Extensions/Effects/pixelate-pixi-filter.js');
const pixelateProperties = pixelateEffect.getProperties();
pixelateProperties
.getOrCreate('size')
.setValue('10')
.setLabel(_('Size'))
.setType('number')
.setDescription(_('Size of the pixels (10 pixels by default)'));
const radialBlurEffect = extension
.addEffect('RadialBlur')
.setFullName(_('Radial Blur'))
.setDescription(_('Applies a Motion blur to an object.'))
.markAsOnlyWorkingFor2D()
.addIncludeFile('Extensions/Effects/pixi-filters/filter-radial-blur.js')
.addIncludeFile('Extensions/Effects/radial-blur-pixi-filter.js')
.markAsNotWorkingForObjects(); // See https://github.com/pixijs/filters/issues/304
const radialBlurProperties = radialBlurEffect.getProperties();
radialBlurProperties
.getOrCreate('radius')
.setValue('-1')
.setLabel(_('Radius'))
.setType('number')