distraction/shaders/background.py

8 lines
379 B
Python
Raw 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): # https://www.shadertoy.com/view/lsyyz3
2020-02-12 13:11:57 +01:00
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)