home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 20 / AACD20.BIN / AACD / Graphics / PerfectPaint / rexx / ellipse / AnimPainting_Ellipse.rx next >
Text File  |  1999-12-09  |  1KB  |  79 lines

  1. /* Script Rexx
  2.     AnimPainting for Ellipse*/
  3.  
  4.     call addlib("rexxmathlib.library", 5, -30, 0)
  5.  
  6.     options results
  7.   parse ARG Port x1 y1 r r2 b
  8.  
  9.     ADDRESS COMMAND
  10.     sens=0
  11.     if EXISTS('PerfectPaint:Prefs/Rexx_Prefs/AnimPainting_Ellipse') THEN DO
  12.         IF OPEN('lfile','PerfectPaint:Prefs/Rexx_Prefs/AnimPainting_Ellipse', "R") then DO
  13.             sens = READLN('lfile')
  14.             CALL CLOSE('lfile')
  15.         END
  16.     END
  17.  
  18.     ADDRESS value Port
  19.     pp_DialogInit 250 60 "*AnimPainting*Ellipse*" 1
  20.         pp_Cycle 0 100 8 100 16 "Order" 1 "--->|<---" sens
  21.     pp_Dialog
  22.     rc=result
  23.     if rc=0 then
  24.         do
  25.             EXIT
  26.         end        
  27.  
  28.     pp_GetDialog 0
  29.     sens=result
  30.  
  31.     CALL SavePrefs('AnimPainting_Ellipse',sens)
  32.     ADDRESS value Port
  33.  
  34.     pp_CountFrames
  35.     nb=result
  36.     IF nb<2 then DO
  37.         pp_Warn 'Make*an*Anim*first.'
  38.         EXIT
  39.     END    
  40.  
  41.     Pi=3.1415926/180
  42.  
  43.     if sens=0 then DO
  44.       DO i=359 To 0 by -1
  45.         x = Sin(i*Pi)*r+x1
  46.       y = Cos(i*Pi)*r2+y1
  47.             pp_Plot x y
  48.             pp_NextFrame
  49.     END
  50.     END
  51.     ELSE
  52.       DO i=0 To 359
  53.       x = Sin(i*Pi)*r+x1
  54.       y = Cos(i*Pi)*r2+y1
  55.             pp_Plot x y
  56.             pp_NextFrame
  57.          END
  58.  
  59. EXIT
  60.  
  61. SavePrefs: PROCEDURE
  62.     
  63.     Prefname='PerfectPaint:Prefs/Rexx_Prefs/'||ARG(1)
  64.  
  65.     if EXISTS(Prefname) THEN DO
  66.         ADDRESS COMMAND
  67.         'delete >nil: '||Prefname
  68.     END
  69.  
  70.     IF OPEN('pfile',PrefName,'W') THEN DO
  71.  
  72.     do i=2 to ARG()
  73.         CALL WRITELN('pfile',ARG(i))
  74.     end
  75.  
  76.     CALL CLOSE('pfile')
  77.  
  78. RETURN
  79.