-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSpirangle.hs
More file actions
40 lines (28 loc) · 843 Bytes
/
Copy pathSpirangle.hs
File metadata and controls
40 lines (28 loc) · 843 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
-- Spirangle.hs
-- copied from https://github.com/sleexyz/hylogen-fun/blob/master/Spirangle.hs
{-# LANGUAGE GADTs #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE FlexibleContexts #-}
module Spirangle where
import Util
output = toProgram (spirangle osc1)
spirangle draw = rgba where
rgba = (line)
& (over (b2a bb))
& (clamp 0 1)
bb = q (texture2D backBuffer) uvN
q x = x
& lmap (view norm)
& lmap (rot ((negate 2 * pi /3) + muchless sin time ))
& lmap (*1.1)
& rmap (clamp 0 1)
mask :: (Veccable n) => Vec n -> Vec n
mask x = (x `gt` 0) ? (0, 1)
gate :: (Veccable n) => Vec n -> Vec n -> Vec n -> Vec n
gate s e x = ((x `geq` s) * (x `lt` e)) ? (1, 0)
line :: Vec4
line = vec4 (v, v, v, 1)
v = 1
& (*(gate (-0.35) (-0.33) (y_ uvN)))
& (*(gate (-0.55) (0.65) (x_ uvN)))
& (*draw)