distraction/shaders/background.py
2020-02-12 14:10:50 +01:00

8 lines
379 B
Python

import math
from pixel import Pixel
def main(pixel: Pixel, resolution: tuple, frag_coord: tuple, time: float): # https://www.shadertoy.com/view/lsyyz3
uv = (frag_coord[0] / resolution[0], frag_coord[1] / resolution[1])
h = math.sin(uv[0] * math.pi + uv[1] * 10.0 + time + math.cos(uv[0] * uv[1] + uv[1] * 7.1823) * math.sin(uv[0] * 14.2))
pixel.background_color.set(h, h, h)