this is pretty simple stuff, and sorry if it's duplicated but I couldn't find one from cursory searching:

a colour cycling

shader!

pixel code:

Code: Select all

```
extern number time;
number t;
vec4 effect(vec4 color, Image tex, vec2 tc, vec2 pc)
{
t = time * 1.5; //may want to vary this for cycle speed?
color = Texel(tex, tc);
return vec4(vec3(sin(t + 5)+0.3, -sin(t+5)+0.3, sin(t + 10)) * (max(color.r, max(color.g, color.b))), 1.0); //cycles colors and pulses brightness slightly
}
```

vertex code (standard, doing nothing special):

Code: Select all

```
varying vec4 vpos;
vec4 position( mat4 transform_projection, vec4 vertex_position )
{
vpos = vertex_position;
return transform_projection * vertex_position;
}
```

then send time to the

shader every update:

Code: Select all

```
--shader updates
self.t = self.t + math.min(dt, 1/30)
self.bgShader:send("time", self.t)
```

I recently used this with a repeated grey scrolling gradient to produce a lovely "retro" effect (attached .love)

I realise I could do the whole effect in a

shader, but I'm still dipping my toes here, and the color cycling can be applied to whatever you're drawing now!