Ann: Simple Spirograph-like toy program.

Geoff Canyon gcanyon at inspiredlogic.com
Mon Jun 20 02:56:43 EDT 2005


On Jun 18, 2005, at 6:47 AM, Alex Tweedly wrote:

>
> In Revonline, under alextweedly (or under category Games), called  
> Spirograph
>
> Very simple, but quite fun (and totally dependent on accurate  
> slider values :-)
>
>
> -- 
> Alex Tweedly       http://www.tweedly.net

Alex, I made a few changes to the script that I liked, so here they  
are. This adds a display of the number of points in the graphic,  
useful for scaring myself about making rev crash ;-) It also changes  
the frequency of updates to the graphic, making it time-dependent so  
that the field/graphic aren't updated needlessly -- instead it  
refreshes about 20-30 times per second, which retains the nice smooth  
feel of the original, while working much faster, especially at the  
end as the point count piles up.

  put 0 into tPointCount
   put 0 into tLastTicks
   repeat while gKeepDrawing and abs(t) <= lRevs
     add 1 to tPointCount

     put (rSum * t) / mR into exprResult
     put trunc(round(rSum*cos(t) - mO*cos(exprResult) + xOff)) into x
     put trunc(round(rSum*sin(t) - mO*sin(exprResult) + yOff)) into y

     put x,y & cr after thePoints
     if ticks() - tLastTicks > 2 then
       set the points of graphic "Spiro" to thePoints & cr & lastX,  
lastY & cr
       set the text of field "lblProgress" to "Revolutions : " & t &  
tab & "Points:" && tPointCount
       put ticks() into tLastTicks
     end if
     add s to t
     --    put rSum && t && s && fR && mR && mO && x,y & cr after msg

     wait 3 millisecond with messages
   end repeat



More information about the use-livecode mailing list