whirl.shader 388 B

1234567891011121314
  1. shader_type canvas_item;
  2. uniform float rotation = 3.0;
  3. void fragment() {
  4. vec2 uv = SCREEN_UV;
  5. vec2 rel = uv - vec2(0.5, 0.5);
  6. float angle = length(rel) * rotation;
  7. mat2 rot = mat2(vec2(cos(angle), -sin(angle)), vec2(sin(angle), cos(angle)));
  8. rel = rot * rel;
  9. uv = clamp(rel + vec2(0.5,0.5), vec2(0.0, 0.0), vec2(1.0, 1.0));
  10. COLOR.rgb = textureLod(SCREEN_TEXTURE, uv, 0.0).rgb;
  11. }