Here's another version. See if it works better on Mac.
Invalidated WD is considered more proper way to update UI.
NB.
===============================================================================================================
NB. olegyk: invalidated wd update; remove unneeded code; normalized spaces
coinsert 'jgl2' [ require 'gl2'
MESSAGE =: 'Hello World! '
TIMER_INTERVAL =: 0.5 * 1000 NB.
milliseconds
DIRECTION =: 1 NB.
initial direction is right -->
ANIM =: noun define
pc anim nomax;pn "Basic Animation in J";
xywh 1 1 174 24;cc isi isigraph rightmove bottommove;
pas 0 0;pcenter;pshow;
)
anim_run =: verb def ' wd ANIM,''; timer '',":TIMER_INTERVAL '
sys_timer_z_ =: verb def ' wd ''psel anim; setinvalid isi'' ' NB.
rotate MESSAGE according to DIRECTION
anim_isi_mbldown =: verb def ' DIRECTION=: - DIRECTION ' NB.
reverse direction when user clicks
anim_close =: verb def ' wd ''timer 0; pclose'' ' NB.
shut down timer
anim_isi_paint =: verb define
glfont '"courier new" 36'
gltext MESSAGE =: DIRECTION |. MESSAGE NB.
paint MESSAGE rotated in DIRECTION
)
anim_run ''
NB.
===============================================================================================================
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm