-
Notifications
You must be signed in to change notification settings - Fork 0
/
pumpkin.lua
64 lines (51 loc) · 987 Bytes
/
pumpkin.lua
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
-- pumpkin.
--
-- @von_rostock
-- twitter.com/user/status/1322693583623884803
--
-- ported by @eigen
-- ------------------------------------------------------------------------
-- init
include('p8/lib/p8')
function init()
screen.aa(0)
screen.line_width(1)
-- redraw()
end
local fps = 5000
redraw_clock = clock.run(
function()
local step_s = 1 / fps
while true do
clock.sleep(step_s)
redraw()
end
end)
function cleanup()
clock.cancel(redraw_clock)
end
-- ------------------------------------------------------------------------
-- tweetcart
-- pal({-16,-14,-11,-12,4,-7,-2,9,10,-9,7},1)
cls(1)
s=sin
function redraw()
-- ::_::
r=s(t())
u=rnd()
v=rnd()
c=cos
a=u*.3+.6
b=v*.3+.1
z=2+s(a)*s(b)
x=99*c(a)*s(b)
y=(75+s(u*8)*8*s(v*2))*c(b)
k=c(u/4+r/99)^2*7
if((3-v*5>c(u) and .6<v)or(v<c(u*5)/1.8 and -c(u)>.5 and -s(u/2)/2<v)) then
k=r+v*7+5
end
pset(64+(x/z)/1.5,32-((y/z)/2),k)
-- goto _
-- NB: added explicit flip
flip()
end