Wiggle 2D

Wiggles an element. You can change random offset in code if you are using it on multiple objects and need them to wiggle independantly, just remember to make a new material for each element if doing so.

Shader code
shader_type canvas_item;

uniform float Strength : hint_range(0,20) = 5;
uniform float RandomOffset = 1.0;

float random( float seed )
{
	return fract( 543.2543 * sin( dot( vec2( seed, seed ), vec2( 3525.46 + RandomOffset, -54.3415 ) ) ) );
}

void vertex()
{
	vec2 VERTEX_OFFSET = VERTEX;
	VERTEX_OFFSET.x += (
		random(
			( trunc( VERTEX_OFFSET.y))
		+	TIME
		) - 0.5
	) * Strength ;

	VERTEX_OFFSET.y += (
		random(
			( trunc( VERTEX_OFFSET.x))
		+	TIME
		) - 0.5
	) * Strength;
	
	VERTEX = VERTEX_OFFSET;	
}
Tags
2d, bounce, canvasitem, control, node2d, sprite, warp, wiggle
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 Tanders

Smooth outline 2D

Related shaders

Noise Offset (Wiggle)

VHS with wiggle

Subscribe
Notify of
guest

3 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Josh H
Josh H
2 years ago

This is awesome! How would I slow down the rate of wiggling?

Jared K
Jared K
4 months ago

wish you made one for warping.