forked from monome/bowery
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgingerbread.lua
More file actions
37 lines (33 loc) · 737 Bytes
/
Copy pathgingerbread.lua
File metadata and controls
37 lines (33 loc) · 737 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
--- gingerbread man chaotic attractor
-- input1: clock
-- input2: offset
-- output1: X1
-- output2: Y1
-- output3: X2
-- output4: Y2
-- TODO view in x-y mode
function init()
input[1]{ mode = 'change'
, direction = 'rising'
}
end
-- two instances
gs = { {x=0,y=0}
, {x=0,y=0}
}
function make_bread(g, xoff, yoff)
local x1 = g.x
g.x = 0.5 - g.y + math.abs(x1) + xoff
g.y = x1 + yoff
if g.x > 5 then g.x = 5.0 end
if g.y > 5 then g.y = 5.0 end
end
input[1].change = function()
make_bread(gs[1], input[2].volts, 0)
make_bread(gs[2], 0, input[2].volts)
for n=1,2 do
output[n*2-1].volts = gs[n].x
output[n*2].volts = gs[n].y
end
for n=1,4 do public.view.output[n]() end
end