forked from 4ian/GDevelop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
drop-shadow-pixi-filter.ts
39 lines (39 loc) · 1.53 KB
/
drop-shadow-pixi-filter.ts
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
namespace gdjs {
gdjs.PixiFiltersTools.registerFilterCreator('DropShadow', {
makePIXIFilter: function (target, effectData) {
const dropShadowFilter = new PIXI.filters.DropShadowFilter();
return dropShadowFilter;
},
updatePreRender: function (filter, target) {},
updateDoubleParameter: function (filter, parameterName, value) {
const dropShadowFilter = (filter as unknown) as PIXI.filters.DropShadowFilter;
if (parameterName === 'blur') {
dropShadowFilter.blur = value;
} else if (parameterName === 'quality') {
dropShadowFilter.quality = value;
} else if (parameterName === 'alpha') {
dropShadowFilter.alpha = value;
} else if (parameterName === 'distance') {
dropShadowFilter.distance = value;
} else if (parameterName === 'rotation') {
dropShadowFilter.rotation = value;
} else if (parameterName === 'padding') {
dropShadowFilter.padding = value;
}
},
updateStringParameter: function (filter, parameterName, value) {
const dropShadowFilter = (filter as unknown) as PIXI.filters.DropShadowFilter;
if (parameterName === 'color') {
dropShadowFilter.color = gdjs.PixiFiltersTools.rgbOrHexToHexNumber(
value
);
}
},
updateBooleanParameter: function (filter, parameterName, value) {
const dropShadowFilter = (filter as unknown) as PIXI.filters.DropShadowFilter;
if (parameterName === 'shadowOnly') {
dropShadowFilter.shadowOnly = value;
}
},
});
}