Wobble / shake with adjustable speed and amplitude

Make sprite move in a different directions with varying speed and amplitude.

Change amplitude parameter to set the range of motion.
Change speed to make motion slower or faster.
Set speed or amplitude to 0 to stop movement altogether.

Shader code
shader_type canvas_item;

uniform float amplitude: hint_range(0.0, 1.0);
uniform float speed: hint_range(0.0, 2.0);
void vertex() {
	// Called for every vertex the material is visible on.
	float time = TIME * (30. * speed);
	float wobbling = sin(time) * 40. * amplitude;
	float direction = sin(time / 2.);
	VERTEX += vec2(direction * wobbling,wobbling);
	//VERTEX += direction;
}
Live Preview
Tags
canvas, floating, shaking, vibrate, wobble, wondering
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 qDRot

Related shaders

guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments