Created
April 10, 2021 00:31
-
-
Save AshyIsMe/f3a378c1ba96291eb0b721c5934b1ca0 to your computer and use it in GitHub Desktop.
Animation in J
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NB. Code from the "Basic Animation In J" video | |
NB. https://www.youtube.com/watch?v=uL-70fMTVnw | |
NB. --------------------------------------------------------- | |
NB. animation demo | |
load 'viewmat' | |
coinsert'jgl2' | |
wd 'pc w0 closeok' NB. parent control (window) named 'w0' | |
wd 'minwh 500 500; cc g0 isidraw;' NB. add an 'isidraw' child control named 'g0' | |
wd 'pshow; pmove 40 510 0 0' NB. show the window at the given coordinates. | |
wd 'sm focus term' NB. session manager: bring terminal to front | |
wd 'psel w0; ptop' NB. bring our window to front | |
vmcc=: glpaint_jgl2_@viewmatcc_jviewmat_ NB. viewmat to a child control | |
NB.step=: render @ update NB. each step, we'll call those two in sequence | |
xaxis=: i.100 | |
yaxis=: i.100 | |
i=:1 | |
p=.(255 255 255,:0 0 0) | |
step=: verb define | |
im=: i |~ xaxis (22 b.)/ yaxis | |
i=:1+i | |
NB.im=:?10 10 $ 100 | |
vmcc im;'g0' | |
) | |
sys_timer_z_ =: step_base_ | |
wd 'timer 10' | |
NB.wd 'timer 0' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment