{
    "QEN": {
        "description": "Simple swirl distortion effect. The effect uses by default 100 x 100 sized grid mesh and adjusts the geometry accoring to the given parameters. The item size should be scaled big enough to allow for the distortion without revealing the edges of the distorted item geometry.",
        "name": "Swirl",
        "properties": [
            {
                "defaultValue": "4",
                "description": "Sets how tightly or loosely the swirls wrap around the center point.",
                "maxValue": "10",
                "minValue": "0",
                "name": "swirlWaveLength",
                "displayName": "Wave Length",
                "type": "float"
            },
            {
                "defaultValue": "0.05",
                "description": "Sets the intensity of the swirl. This defines how far the graphics deviate from the center point.",
                "maxValue": "0.5",
                "minValue": "0",
                "name": "swirlAmplitude",
                "displayName": "Amplitude",
                "type": "float"
            },
            {
                "defaultValue": "0",
                "description": "Sets the starting point of the swirl.",
                "maxValue": "1",
                "minValue": "0",
                "name": "swirlPhase",
                "displayName": "Phase",
                "type": "float"
            },
            {
                "defaultValue": "0.5, 0.5",
                "description": "Sets the point around which the swirl effect revolves. 0.5, 0.5 is the center.",
                "maxValue": "1, 1",
                "minValue": "0, 0",
                "name": "swirlCenterPoint",
                "displayName": "Center Point",
                "type": "vec2"
            }
        ],
        "version": 1,
        "vertexCode": [
            "@mesh 100, 100",
            "#define TAU 6.28318530718",
            "@main",
            "{",
            "    const vec2 cp = iResolution.xy * swirlCenterPoint;",
            "    const vec2 d = vertCoord - cp;",
            "    if (d.x != 0.0 || d.y != 0.0) {",
            "        const float dd = sqrt(d.x*d.x + d.y*d.y);",
            "        float a = atan(d.y, d.x);",
            "        a += sin((dd * swirlWaveLength / iResolution.x + swirlPhase) * TAU) * swirlAmplitude;",
            "        vertCoord.x = cp.x + cos(a) * dd;",
            "        vertCoord.y = cp.y + sin(a) * dd;",
            "    }",
            "}"
        ]
    }
}
