Skip to content

Instantly share code, notes, and snippets.

@AshyIsMe
Created May 8, 2021 04:06
Show Gist options
  • Save AshyIsMe/270302a0e7b003a011aa83c3d0dcadef to your computer and use it in GitHub Desktop.
Save AshyIsMe/270302a0e7b003a011aa83c3d0dcadef to your computer and use it in GitHub Desktop.
processing style playing with j
NB. jgl2 animation demo for j
NB. Based on https://code.jsoftware.com/wiki/Guides/Window_Driver/Animation/Animated_JGL2
NB. by (c) 2019 by michal j wallace http://tangentstorm.com/
NB. free for use under the MIT license. https://opensource.org/licenses/MIT
load 'gl2'
coinsert 'jgl2'
close_handler =: 3 : 0
wd 'timer 0;psel w0;pclose'
)
NB. janimate =: verb define
janimate =: monad define
wd 'pc w0;pn "J Animation"' NB. parent control (window) named 'w'.
wd 'minwh 500 500; cc g0 isidraw' NB. add an 'isidraw' child control named 'g'
wd 'pshow' NB. show the window at the given coordinates.
w0_close =: close_handler
NB. TODO broken: sys_timer_z_ =: x
sys_timer_z_ =: draw_base_
wd 'timer 100' NB. start timer with this many ms between ticks
)
NB. TODO Why is this not rendering?
update=: 3 : 'rects=: ? 4 4 $ 100'
render=: 3 : 'glrect rects'
draw=:render @ update
NB. janimate''
@AshyIsMe
Copy link
Author

AshyIsMe commented May 8, 2021

The idea for usage is something along these lines:

load '~temp/janimate.ijs'
draw=: verb define
...
)

janimate''

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment