phaser4-rex-plugins
Version:
44 lines (32 loc) • 836 B
JavaScript
// Built-in fx in phaser3
const frag = `\
precision highmedp float;
// Scene buffer
uniform sampler2D uMainSampler;
varying vec2 outTexCoord;
// Effect parameters
uniform vec2 config;
uniform vec2 position;
void main (void) {
float radius = config.x;
float strength = config.y;
vec4 col = vec4(1.0);
float d = length(outTexCoord - position);
if (d <= radius)
{
float g = d / radius;
g = sin(g * 3.14 * strength);
col = vec4(g * g * g);
}
vec4 texture = texture2D(uMainSampler, outTexCoord);
gl_FragColor = texture * (1.0 - col);
}
`;
export default frag;