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/TwirlUV.gdshaderinc
Digvijaysinh Gohil 41f30c2889 TwirlUV node added
2023-10-12 19:28:04 +05:30

7 lines
326 B
Plaintext

vec2 twirl_uv(vec2 uv, vec2 center, float strength, vec2 offset){
vec2 _delta = uv - center;
float _angle = strength * length(_delta);
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);
}