Sine Morphing

Morphs a texture using sine waves

Uniforms:
Amplitude: How much the sine wave morphs the image

Speed: The direction and speed of the morph

Shader code
shader_type canvas_item;

// --- Uniforms --- //
uniform vec2 amplitutde = vec2(1.0, 0.0);
uniform vec2 speed = vec2(1.0, 0.0);

// --- Functions --- //
void fragment() {
	vec2 pos = mod((UV - amplitutde * sin(TIME + vec2(UV.y, UV.x) * speed)) / TEXTURE_PIXEL_SIZE,
			1.0 / TEXTURE_PIXEL_SIZE) * TEXTURE_PIXEL_SIZE;
	COLOR = texture(TEXTURE, pos);
}
Live Preview
Tags
morphing, sine, sine wave, trig
The shader code and all code snippets in this post are under CC0 license and can be used freely without the author's permission. Images and videos, and assets depicted in those, do not fall under this license. For more info, see our License terms.

More from KingToot

Related shaders

guest

2 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
caelohm
11 months ago

How did you make it only move on the x axis instead of both at once ?

caelohm
11 months ago
Reply to  caelohm

nevermind I got it more or less