Created
March 19, 2020 15:07
-
-
Save jimmyjonezz/b339415c8f674955c7e1a35208f1d4ae to your computer and use it in GitHub Desktop.
squash shader
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; | |
render_mode blend_mix; | |
uniform float squash_power = 0.0; | |
uniform float squash_position = 0.0; | |
void fragment() { | |
vec2 uv = SCREEN_UV; | |
float PI = 3.14159; | |
float squash = cos((uv.y + (squash_position)) * PI * 2.0 + PI * 0.5) * squash_power; | |
uv.x = uv.x * (1.0 - squash) + .5 * squash; | |
COLOR = texture(SCREEN_TEXTURE, uv); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment