Matrix digital rain: Difference between revisions
m
J: rebuild to better match the movie
m (J: some minor documentation) |
m (J: rebuild to better match the movie) |
||
Line 1,049:
=={{header|J}}==
This implementation was written for jqt under j903, after studying https://youtu.be/MvEXkd3O2ow
Some key issues are the relatively low resolution of the screen, a somewhat slow update rate and some variation over time in the update rate of the screen. This is, of course, only an approximation...
<lang J>require'ide/qt/gl2'
Line 1,055 ⟶ 1,057:
junk=: 7 u:;48 65 16b30a1(+i.)&.>10 26 90
sz=:
len=: <.1.4*{:sz
heat=:
cols=: i.0
rows=: i.0
scale=: 24
live=: (#heat)#<i.3 0
update=: {{
try. glfill 0 0 0 255 catch. wd'timer 0' return. end.
glfont font=.'courier ',":0.8*scale
upd=. 0>._3++/?2 2 2 2 4
cols=: cols,upd{.(?~{.sz)-.(-<.0.3*{:sz){.cols
live=: }.live,<(scale*cols,.rows),.?(#cols)##junk
for_p.
gltextcolor glrgb
if.p_index=<:#live do.
gltextxy 10*xy▼
end.
for_xyj.;p do.
gltext 8 u:junk{~{:xyj
end.
end. glpaint''
keep=: rows<{:sz-1
cols=: keep#cols
Line 1,085 ⟶ 1,090:
sys_timer_z_=: update_base_
wd rplc&('DIMS';":
pc rain closeok;
setp wh DIMS;
cc green isidraw flush;
pshow;
timer
}}</lang>
Notes:
<tt>timer
FIXME: document some of the rest of this...
=={{header|Javascript}}==
|