>Hi folks, > >It's been a while since I've worked with FB, and a client has asked me to >add a small animation-based component to a program I wrote for him some >while back. > >This is a PG-based program, and here's what I have to do: I need to make an >approximately dime-sized red circle move along the edges of a window at a >set rate, so that the dexterity and attention span of a test subject can be >measured as they attempt to keep a set of cross-hairs centered on the >circle. > >Can anyone give me a push in the direction of a good PG-based technique for >animating my circle? > >Thanks in advance for any suggestions! Jason, While there's no reason NOT to learn about gworlds, here is a simpler approach using Regions that may be all you need. I didn't put this into PG, but it's simply a matter of 2 fns, plus a line to add to your FN doEvents to trap null events. e-e =J= a y " //This code runs as is: begin globals dim as hndl dot,oldRgn dim as long moveTime dim as int direction dim as rect wndRect _dotSize = 36 _moveSize = 6 _delayticks = 3 begin enum _rt _dn _lf _up end enum end globals local fn initDot dim as rect r setrect(wndRect,0,0,600,500) window 1,"Moving dot",(0,0)-(wndRect.right,wndRect.bottom) dot = fn newrgn oldRgn = fn newrgn insetrect(wndRect,15,15) setrect(r,15,15,_dotSize + 15,_dotSize + 15) openrgn frameoval( r ) closergn( dot ) direction = _rt color _zRed paintrgn( dot ) end fn local fn moveDot(time as long) dim as rect r,t dim as int h,v,dummy if time < movetime then exit fn ' copyrgn(dot,oldRgn) movetime = time + _delayticks "checkBounds" select direction case _rt : h = _moveSize : v = 0 case _dn : h = 0 : v = _moveSize case _lf : h = -_moveSize : v = 0 case _up : h = 0 : v = -_moveSize end select r;8 = @oldRgn..rgnBBox% offsetrect(r,h,v) dummy = fn sectrect(r,wndRect,t) long if fn equalRect(r,t) = _false def cycle (_rt,_up,direction) exit "checkBounds" end if offsetrgn(dot,h,v) diffrgn(oldRgn,dot,oldRgn) color _zRed paintrgn(dot) erasergn(oldRgn) end fn LOCAL FN DoEvent dim eventRecPtr& eventRecPtr& = event select eventRecPtr&.evtNum% case _nullevt fn moveDot(eventRecPtr&.evtTicks&) end select END FN on event fn doEvent fn initDot '----------------- DO HANDLEEVENTS UNTIL 0 '-----------------