Remember the NSProgressIndicator OS X?

Wouter wouter.abraham at pi.be
Fri Jul 16 14:23:43 EDT 2004


For those who like to play,
paste the following starter script into a button:

constant cStar = "grc runningStar"
local aPoints,runState,Cp

on mouseUp
   if runstate  = 0 then set the label of me to "Stop Running"
   else set the label of me to ""
   if runstate <> 0  then
     stopLines
     exit to top
   end if
   if there is no grp "runningStar" then goCreateSome
   put the right of me + 20,item 2 of the loc of me into CP
   put 9 into runState
   delete var aPoints
   prepArray  11,7
   startLines
   runLines
end mouseUp

on stopLines
   repeat with i = 7 down to 1
     put cStar & i into tStar
     hide tSTar
     wait 50 millisecs
   end repeat
   put 0 into runState
end stopLines

on startLines
   repeat with i = 7 down to 1
     put cStar & i into tStar
     put runstate - i  + 1 into x
     if x <= 0 then add 12 to x
     set the points of tSTar to aPoints[x]
     show tSTar
     wait 70 millisecs
   end repeat
end startLines

on runLines
   if runState <> 0 then
     repeat with i = 1 to 7
       put cStar & i into tStar
       put runstate - i  + 1 into x
       if x <= 0 then add 12 to x
       set the points of tSTar to aPoints[x]
     end repeat
     if runstate = 12 then put 1 into runstate
     else add 1 to runState
     send "runLines" to me in 70 millisecs
   end if
end runLines

on prepArray  tG,tK
   put item 1 of Cp into tX
   put item 2 of Cp into tY
   put (2 * pi / 12) into sRad
   repeat with i = 1 to 12
     put trunc(tG * cos (sRad * i)) + tX into a
     put trunc(tG * sin (sRad * i)) + tY into b
     put trunc(tK * cos (sRad * i)) + tX into c
     put trunc(tK * sin (sRad * i)) + tY into d
     put a,b & cr & c,d into aPoints[i]
   end repeat
end prepArray

### for those who like 1 liners,
###beware of the linewrap
put trunc(tG * cos (sRad * i)) + tX,trunc(tG * sin (sRad * i)) + tY & 
cr & trunc(tK * cos (sRad * i)) + tX,trunc(tK * sin (sRad * i)) + tY  
into aPoints[i]
###

on goCreateSome
   put 110 into tX
   repeat with i = 1 to 7
     put tX,tX,tX into tColors[i]
     add 20 to tX
   end repeat
   repeat with i = 1 to 7
     put cStar&i into tStar
     do "create invisible" && tStar
     set the style of tStar to polygon
     set the linesize of tStar to 2
     set the colors of tStar to tColors[i]
     put the name of tStar && "and "  after tList
   end repeat
   delete last word of tList
   do "group" && tList
   set the name of last grp to "runningStar"
   choose browse tool
end goCreateSome



Have fun.
Greetings,
WA



More information about the use-livecode mailing list