Capture the Trig Function from an Option Menu Button

Roger Guay irog at mac.com
Mon Dec 10 12:42:55 EST 2012


This script is amazingly fast! And so are you, having apparently produced it in less than an hour!! My script appears to be slightly slower using a switch/case structure. I'll test it out when I get a moment.

Thanks very much,
Roger


On Dec 10, 2012, at 8:59 AM, Jim Hurley <jhurley0305 at sbcglobal.net> wrote:

> It turns out that Do is fast enough. Here is the Do script:
> (The script might read a litle better by using "x" in the repeat loop instead of "i".)
> 
> on mouseUp
>   put the label of btn "myOptionMenu" into tTrigFunction
>   --It might be necessary  to take care in using the following replacements 
>   replace "sine" with "sin" in tTrigFunction
>   replace "cosine" with "cos" in tTrigFunction
>   replace "tangent" with "tan" in tTrigFunction
>   put round(the width of this card/2) into x0
>   put  round(the height of this card/2) into y0
>   put 50 into Amp--Amplitude of the trig curve
>   set the points of grc "myCurve" to empty
>   wait 0 millisec -- Force a screen refresh on the Mac
>   repeat with i = 1 to 360--maybe with a step of 2 or 4
>      put i*pi/180 into tAngle
>       get   "put the " & tTrigFunction  & " of " & tAngle &  " into y " 
>      do it
>      put round(Amp*y) into y
>      put i into x
>      put x+ x0, y+y0 into tPoint
>      put tPoint & cr after tPoints
>      --Uncomment the following to see the curve evolve
>      --set the points of grc "myCurve" to tPoints
>      --wait 0 millisec
>   end repeat
>   set the points of grc "myCurve" to tPoints
> end mouseUp
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list