/******************************************************************************
welcome to the tinsl playground! right now you're looking at a comprehensive
code example that shows off many features of the language. if you want
something less overwhelming, try "one liners" (select that option from the
bottom right menu). click the run button at the bottom to run the program.
everything you see is a work in progress so feedback and github issues are
welcome. check out the readme on the github page for more details about the
language: https://github.com/bandaloo/tinsl
******************************************************************************/
// uniforms (in playground only!) that match the pattern ^fft[0-9]+$ will
// automatically be updated with the FFT frequency data from your mic.
// fft0 is the lowest and fft127 is the highest
uniform float fft0;
// some colors for our blinking lights
def colors vec4[](
'magenta'4,
'cornflower blue'4,
'crimson'4,
'green yellow'4,
'aquamarine'4,
'orange red'4
)
// converts seconds to milliseconds
def seconds time / 1000.
// define to easily index the color array by time
def chosen_color colors[int(seconds) % 6]
// fast gaussian blur
// from https://github.com/Jam3/glsl-fast-gaussian-blur/blob/master/9.glsl
fn blur(vec2 direction, int channel = -1) {
uv := npos;
mut color := vec4(0.0);
off1 := vec2(1.3846153846) * direction;