Curved and Vertical Motion For Text

My first Shader! 

A simple effect to apply a sine wave along the X-axis, lowering the sides and rising the middle.

This shader creates a curved text effect by applying a sine wave distortion along the X-axis, making the center of the text rise and the sides curve down.

  • The uniform wave_amplitude controls the hight of the curvature;
  • The uniform wave_frequency controls the lenght of the wave, and using roughly half of the size of the Label worked fine

Also added a movement thought another sine wave function, to make the text bounce up and down!

It’s quite simple, but since I didn’t find one available and had to learn how to make it, might as well share it!

Shader code
/*
Shader from Godot Shaders - the free shader library.

Feel free to use, improve and change this shader according to your needs
and consider sharing the modified result on godotshaders.com.
*/

shader_type canvas_item;

uniform float wave_amplitude = 30.0;
uniform float wave_frequency = 140.0;
uniform float movement_speed = 2.0;
uniform float movement_amplitude = 5.0;

void vertex() {
	VERTEX.y -= sin(VERTEX.x / wave_frequency) * wave_amplitude;
	VERTEX.y += sin(TIME * movement_speed) * movement_amplitude;
}
Tags
Label, text
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.

Related shaders

Vertical Drops

How To Get Vertical Camera FOV

Cool 3D text

Subscribe
Notify of
guest

1 Comment
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
SuperYellows
SuperYellows
1 month ago

Great text curve, just what I needed! I added one more parameter, wave_offset, to allow the text to start at a different point on the wave.

I didn’t need the movement (and could easily be accomplished with an AnimationPlayer), but I found it was a nice little bonus effect, so I kept it on 🙂