Constructor

@:glFragmentSource("\n\t\t#pragma header\n\t\t//uniform float tx, ty; // x,y waves phase\n\t\tuniform float uTime;\n\t\t\n\t\tconst int EFFECT_TYPE_DREAMY = 0;\n\t\tconst int EFFECT_TYPE_WAVY = 1;\n\t\tconst int EFFECT_TYPE_HEAT_WAVE_HORIZONTAL = 2;\n\t\tconst int EFFECT_TYPE_HEAT_WAVE_VERTICAL = 3;\n\t\tconst int EFFECT_TYPE_FLAG = 4;\n\t\t\n\t\tuniform int effectType;\n\t\t\n\t\t/**\n\t\t * How fast the waves move over time\n\t\t */\n\t\tuniform float uSpeed;\n\t\t\n\t\t/**\n\t\t * Number of waves over time\n\t\t */\n\t\tuniform float uFrequency;\n\t\t\n\t\t/**\n\t\t * How much the pixels are going to stretch over the waves\n\t\t */\n\t\tuniform float uWaveAmplitude;\n\n\t\tvec2 sineWave(vec2 pt)\n\t\t{\n\t\t\tfloat x = 0.0;\n\t\t\tfloat y = 0.0;\n\t\t\t\n\t\t\tif (effectType == EFFECT_TYPE_DREAMY) \n\t\t\t{\n\t\t\t\tfloat offsetX = sin(pt.y * uFrequency + uTime * uSpeed) * uWaveAmplitude;\n pt.x += offsetX; // * (pt.y - 1.0); // <- Uncomment to stop bottom part of the screen from moving\n\t\t\t}\n\t\t\telse if (effectType == EFFECT_TYPE_WAVY) \n\t\t\t{\n\t\t\t\tfloat offsetY = sin(pt.x * uFrequency + uTime * uSpeed) * uWaveAmplitude;\n\t\t\t\tpt.y += offsetY; // * (pt.y - 1.0); // <- Uncomment to stop bottom part of the screen from moving\n\t\t\t}\n\t\t\telse if (effectType == EFFECT_TYPE_HEAT_WAVE_HORIZONTAL)\n\t\t\t{\n\t\t\t\tx = sin(pt.x * uFrequency + uTime * uSpeed) * uWaveAmplitude;\n\t\t\t}\n\t\t\telse if (effectType == EFFECT_TYPE_HEAT_WAVE_VERTICAL)\n\t\t\t{\n\t\t\t\ty = sin(pt.y * uFrequency + uTime * uSpeed) * uWaveAmplitude;\n\t\t\t}\n\t\t\telse if (effectType == EFFECT_TYPE_FLAG)\n\t\t\t{\n\t\t\t\ty = sin(pt.y * uFrequency + 10.0 * pt.x + uTime * uSpeed) * uWaveAmplitude;\n\t\t\t\tx = sin(pt.x * uFrequency + 5.0 * pt.y + uTime * uSpeed) * uWaveAmplitude;\n\t\t\t}\n\t\t\t\n\t\t\treturn vec2(pt.x + x, pt.y + y);\n\t\t}\n\n\t\tvoid main()\n\t\t{\n\t\t\tvec2 uv = sineWave(openfl_TextureCoordv);\n\t\t\tgl_FragColor = texture2D(bitmap, uv);\n\t\t}")new()

Variables

@:keepeffectType:ShaderParameter_Int

@:keeptx:ShaderParameter_Float

@:keepuFrequency:ShaderParameter_Float

@:keepuSpeed:ShaderParameter_Float

@:keepuTime:ShaderParameter_Float

@:keepuWaveAmplitude:ShaderParameter_Float