forked from 4ian/GDevelop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
godray-pixi-filter.ts
40 lines (39 loc) · 1.36 KB
/
godray-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
// @ts-nocheck - TODO: fix typings in this file
namespace gdjs {
gdjs.PixiFiltersTools.registerFilterCreator('Godray', {
makePIXIFilter: function (layer, effectData) {
const godrayFilter = new PIXI.filters.GodrayFilter();
return godrayFilter;
},
updatePreRender: function (filter, target) {
if (filter.animationSpeed !== 0) {
filter.time += (target.getElapsedTime() / 1000) * filter.animationSpeed;
}
},
updateDoubleParameter: function (filter, parameterName, value) {
if (parameterName === 'lacunarity') {
filter.lacunarity = value;
} else if (parameterName === 'angle') {
filter.angle = value;
} else if (parameterName === 'gain') {
filter.gain = value;
} else if (parameterName === 'light') {
filter.light = value;
} else if (parameterName === 'x') {
filter.x = value;
} else if (parameterName === 'y') {
filter.y = value;
} else if (parameterName === 'animationSpeed') {
filter.animationSpeed = value;
} else if (parameterName === 'padding') {
filter.padding = value;
}
},
updateStringParameter: function (filter, parameterName, value) {},
updateBooleanParameter: function (filter, parameterName, value) {
if (parameterName === 'parallel') {
filter.parallel = value;
}
},
});
}