vortex and shrink

https://www.shadertoy.com/view/l3t3R2

Shader code
shader_type canvas_item;

uniform float RANGE = .7;
uniform float SPEED  = .5;
uniform float STRENGTH = 6.;

uniform sampler2D iChannel0;

mat2 rotate(float a)
{
    float s = sin(a);
    float c = cos(a);
    return mat2(vec2(c,-s),vec2(s,c));
}

void fragment() {
    vec2 aspect = vec2(TEXTURE_PIXEL_SIZE.x / TEXTURE_PIXEL_SIZE.y, 1.0);
    vec2 center = 0.5 * aspect;
    
    vec2 uv = UV / aspect;
    uv -= center;
    
    float d = length(uv);
    float progress = sin(TIME * SPEED);
    
    //vortex
    float cTime = STRENGTH * progress;
    d = smoothstep(0., RANGE, RANGE - d) * cTime;
    uv *= rotate(d);
    
    //shrink
    float edge = 1. * abs(progress);
    uv = uv + normalize(uv) * edge;
    
    uv += center;
    uv /= aspect;
    if (uv.x > 1. || uv.y > 1. || uv.x < 0. || uv.y < 0.) {
        COLOR = vec4(0., 0., 0., 0.);
    } else {
        COLOR = texture(iChannel0, uv);
    }
} 
This shader is a port from an existing Shadertoy project. Shadertoy shaders are by default protected under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported (CC BY-NC-SA 3.0) license unless anything else has been stated by the author. For more info, see our License terms.

More from RayL019

Kinetic Pupils

Saturday weirdness

{Orange Blossom}

Related shaders

Vortex overlay

Jupiter and Io

Moon Shader 2D All Phases and Roughened Shadow

Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments