Card Shine Sweep

The rarity shine from card games and deck-builders: a bright diagonal band sweeps across the card every few seconds. Put it on a TextureRect or Sprite2D that shows your card art. No extra textures needed, and the shine stays inside the card shape because it follows the texture alpha.

Everything is adjustable from the inspector:

  • period: seconds between sweeps
  • width: how wide the band is
  • strength: how bright it gets
  • shine_color: warm gold by default

Tested in Godot 4.7 with the Compatibility renderer, so it also works in web exports.

Code written with AI assistance, tested by hand in Godot 4.7.
This is one of the 9 card finishes in my Card Game VFX pack: https://pixeldreamerstudio.netlify.app/p/cardvfx/
More free Godot 4 assets: https://pixeldreamerstudio.netlify.app/free/

Shader code
shader_type canvas_item;
// PD Card VFX - rarity shine: a bright band sweeps across the card every few seconds.
uniform float period = 2.6;
uniform float width = 0.1;
uniform float strength = 1.3;
uniform vec4 shine_color : source_color = vec4(1.0, 0.92, 0.7, 1.0);

void fragment() {
	vec4 b = texture(TEXTURE, UV);
	float t = fract(TIME / period) * 2.2 - 0.6;
	float d = (UV.x + (1.0 - UV.y) * 0.6) / 1.6;
	float band = 1.0 - smoothstep(0.0, width, abs(d - t));
	float core = 1.0 - smoothstep(0.0, width * 0.25, abs(d - t));
	COLOR = vec4(b.rgb + shine_color.rgb * (band * 0.6 + core * 0.8) * strength * b.a, b.a);
}
Live Preview
Tags
2d, animated, canvas item, card, deck-building, foil, rarity, shine
The shader code and all code snippets in this post are under MIT license and can be used freely. Images and videos, and assets depicted in those, do not fall under this license. For more info, see our License terms.

More from pixeldreamerstudio

Related shaders

guest

0 Comments
Oldest
Newest Most Voted