Last active
February 1, 2019 08:16
-
-
Save Capital-EX/1565525a7a3e0a038de9dc9a4e8836f8 to your computer and use it in GitHub Desktop.
Simple little shader to animate tiles in Godot
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Sprite sheet | |
uniform texture sprites; | |
// Distance to travel for next sprite | |
uniform vec2 offset_xy; | |
// Size of sprite sheet | |
uniform vec2 texture_wh; | |
// Number of frames | |
uniform float frames; | |
// Frames per second | |
uniform float speed = 1.0; | |
float time = TIME * speed; | |
vec2 offset = offset_xy / texture_wh; | |
offset *= mod(floor(time), frames); | |
COLOR = tex(sprites, UV + offset); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
thank dude!