distraction/shaders/default.py

11 lines
391 B
Python
Raw Permalink Normal View History

2020-02-12 13:11:57 +01:00
import math
from pixel import Pixel
2020-02-12 14:10:50 +01:00
def main(pixel: Pixel, resolution: tuple, frag_coord: tuple, time: float): # default shader when creating a new shader on shadertoy
2020-02-12 13:11:57 +01:00
uv = (frag_coord[0] / resolution[0], frag_coord[1] / resolution[1])
pixel.background_color.set(
0.5 + 0.5 * math.cos(time + uv[0]),
0.5 + 0.5 * math.cos(time + uv[1] + 2),
0.5 + 0.5 * math.cos(time + uv[0] + 4)
)