+1 vote

How is this done in godot 3? I'm looking for some example script, but I'm not finding it.

uniform texture frame1;
uniform texture frame2;
uniform float speed = 1.0;

color col;
float time = fract(TIME*speed);

if (time < 0.2) {
    col = tex(frame1, UV);
} else {
    if (time < 0.4) {
        col = tex(frame2, UV);
COLOR = col;
asked Sep 13, 2017 in Engine by PerduGames (179 points)
edited Sep 13, 2017 by PerduGames

2 Answers

+3 votes

3.0 is still not documented, so you're not going to find that yet.

In the meantime, there are some examples & discussion posts here in QA, and you can find some additional discussion in the Godot issues:

A user here posted a sample recently:

There is also a language reference someone started putting together:

answered Sep 13, 2017 by kidscancode (16,432 points)
+2 votes

very simple too:

shader_type canvas_item; 

uniform sampler2D frame0;
uniform sampler2D frame1;
uniform float speed = 1.0;

void fragment() {
float time = fract(TIME*speed);
if (time < 0.4) {
    COLOR = texture(frame0, UV);
} else {
    COLOR = texture(frame1, UV);

some interesting links too:


answered Sep 14, 2017 by PerduGames (179 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.