forked from 4ian/GDevelop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkawase-blur-pixi-filter.ts
62 lines (62 loc) · 2.02 KB
/
kawase-blur-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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
namespace gdjs {
gdjs.PixiFiltersTools.registerFilterCreator(
'KawaseBlur',
new (class extends gdjs.PixiFiltersTools.PixiFilterCreator {
makePIXIFilter(target: EffectsTarget, effectData) {
const kawaseBlurFilter = new PIXI.filters.KawaseBlurFilter();
return kawaseBlurFilter;
}
updatePreRender(filter: PIXI.Filter, target: EffectsTarget) {}
updateDoubleParameter(
filter: PIXI.Filter,
parameterName: string,
value: number
) {
const kawaseBlurFilter = (filter as unknown) as PIXI.filters.KawaseBlurFilter;
if (parameterName === 'pixelizeX') {
kawaseBlurFilter.pixelSize[0] = value;
} else if (parameterName === 'pixelizeY') {
kawaseBlurFilter.pixelSize[1] = value;
} else if (parameterName === 'blur') {
kawaseBlurFilter.blur = value;
} else if (parameterName === 'quality') {
kawaseBlurFilter.quality = value;
}
}
getDoubleParameter(filter: PIXI.Filter, parameterName: string): number {
const kawaseBlurFilter = (filter as unknown) as PIXI.filters.KawaseBlurFilter;
if (parameterName === 'pixelizeX') {
return kawaseBlurFilter.pixelSize[0];
}
if (parameterName === 'pixelizeY') {
return kawaseBlurFilter.pixelSize[1];
}
if (parameterName === 'blur') {
return kawaseBlurFilter.blur;
}
if (parameterName === 'quality') {
return kawaseBlurFilter.quality;
}
return 0;
}
updateStringParameter(
filter: PIXI.Filter,
parameterName: string,
value: string
) {}
updateColorParameter(
filter: PIXI.Filter,
parameterName: string,
value: number
): void {}
getColorParameter(filter: PIXI.Filter, parameterName: string): number {
return 0;
}
updateBooleanParameter(
filter: PIXI.Filter,
parameterName: string,
value: boolean
) {}
})()
);
}