Skip to content

Instantly share code, notes, and snippets.

@swarnimarun
Created July 4, 2018 17:06
Show Gist options
  • Save swarnimarun/4cd4ad6e3de7709e926c1b60594de508 to your computer and use it in GitHub Desktop.
Save swarnimarun/4cd4ad6e3de7709e926c1b60594de508 to your computer and use it in GitHub Desktop.
shader_type canvas_item;
render_mode unshaded;
uniform sampler2D tex : hint_albedo;
uniform float deform_amt : hint_range(-1,1);
uniform float deform_speed : hint_range(0.5,4);
uniform bool animate;
void fragment() {
float def_amt = deform_amt;
vec4 cl = texture(tex, UV);
if (animate)
def_amt *= sin(TIME * deform_speed);
COLOR = texture(TEXTURE, clamp(UV + cl.r * def_amt / 2.0, vec2(0.0), vec2(1.0)));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment