Created
January 2, 2020 09:20
-
-
Save jimmyjonezz/7866f962c10a2c77c094fe76e093fd4f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
shader_type canvas_item; | |
uniform float _PI = 3.1415926535897932384626433832795; | |
uniform float xx = 4.0; | |
uniform float yy = 2.0; | |
vec2 getPixelShift(vec2 center,vec2 pixelpos,float startradius,float size,float shockfactor, vec2 iResolution) { | |
float m_distance = distance(center,pixelpos); | |
if( m_distance > startradius && m_distance < startradius+size ) { | |
float sin_dist = sin((m_distance -startradius)/size* _PI )*shockfactor; | |
return ( pixelpos - normalize(pixelpos-center)*sin_dist )/ iResolution.xy; | |
} else | |
return pixelpos / iResolution.xy; | |
} | |
void fragment() { | |
vec2 iResolution = (1.0 / SCREEN_PIXEL_SIZE); | |
vec2 shockcenter1 = vec2(iResolution.x / xx, iResolution.y / xx * yy); | |
float startradius = mod(TIME , 1.0) * 600.0; | |
float size = mod(TIME , 1.0) * 200.0; | |
float shockfactor = 50.0 - mod(TIME , 1.0) * 50.0; | |
vec2 total_shift = getPixelShift(shockcenter1, FRAGCOORD.xy,startradius,size,20.0,iResolution); | |
// getPixelShift(shockcenter2,FRAGCOORD.xy,startradius,size,20.0,iResolution); | |
COLOR = texture(SCREEN_TEXTURE,total_shift); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment