1
0
mirror of https://github.com/DigvijaysinhGohil/Godot-Shader-Lib.git synced 2025-01-09 02:43:25 +08:00
Godot-Shader-Lib/addons/ShaderLib/UV/SwirlUV.gdshaderinc
Digvijaysinh Gohil 273d07ae85 SwirlUV node added
2023-12-10 17:46:18 +05:30

8 lines
374 B
Plaintext

vec2 swirl_uv(vec2 uv, vec2 center, float strength, vec2 offset){
vec2 _delta = uv - center;
float _inverse_length = 1.0 - length(_delta);
float _angle = strength * _inverse_length;
float _x = cos(_angle) * _delta.x - sin(_angle) * _delta.y;
float _y = sin(_angle) * _delta.x + cos(_angle) * _delta.y;
return vec2(_x + center.x + offset.x, _y + center.y + offset.y);
}