home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format 61 / af061a.adf / Macros / ColourSeq.clssa < prev    next >
Text File  |  1993-05-01  |  2KB  |  91 lines

  1. /***********************************************************************
  2.  GADGET: "'Colour Sequence'" "6" AUTO TYP: "?"
  3.  
  4.  $DAT >>ColourSeq.clssa<< 01 May 1993 - (C) ProDAD Holger Burkarth
  5.  
  6.  This macro calculates a colour sequence in an animation. The
  7.  user selects a range in the usual way then a colour sequence is
  8.  calculated from the start to the end frame. The bigger the
  9.  colour differences the smaller the selected range and the
  10.  harsher the colour progression.
  11. ************************************************************************/
  12.  
  13. Options Results
  14. Address clariSSA
  15.  
  16.   FailAt 10
  17.   AltFail=RESULT
  18.  
  19.   GetArea
  20.   PARSE VAR RESULT . "FROM" From "TO" To .
  21.  
  22.   Number=To-From
  23.   IF Number>1 THEN DO
  24.  
  25.     DO FOREVER
  26.       GetAnimInfo
  27.       PARSE VAR RESULT . "FORMAT" x y t "VIEWMODE" ViewMode .
  28.       ColNumber=2**t - 1
  29.  
  30.       MSRequester "TITLE '*** Colour Sequence ***''Colour Sequence From "From" To "To"''Please Select An Effect mode.'",
  31.                   "PTEXT 'All Colours ...''Colour Range ...'"
  32.       IF RC~=0 THEN LEAVE
  33.       Mode=RESULT
  34.  
  35.       IF Mode=1 THEN DO
  36.         List=""
  37.         l=0
  38.         DO UNTIL l>ColNumber
  39.           List=List|| l " "
  40.           l=l+1
  41.         END
  42.       END
  43.       ELSE IF Mode=2 THEN DO
  44.         COLRequest "FROM 0 TO 0 TITLE '*** Colour Sequence ***'' ''Please Select A Colour Range''for Processing.'"
  45.         IF RC~=0 THEN LEAVE
  46.         List=RESULT
  47.       END
  48.  
  49.       ViewFrame COPS To
  50.       IF RC~=0 THEN LEAVE
  51.       GetColor List
  52.       Last=RESULT
  53.  
  54.       ViewFrame COPS From
  55.       IF RC~=0 THEN LEAVE
  56.       GetColor List
  57.       Start=RESULT
  58.  
  59.       DO UNTIL From>To
  60.         fa=(1-(To-From)/Number)
  61.  
  62.         ViewFrame COPS From
  63.         IF RC~=0 THEN LEAVE
  64.  
  65.         MStart=Start
  66.         MLast=Last
  67.         l=0
  68.         List=""
  69.         DO UNTIL MStart=""
  70.           PARSE VAR MStart x Sr Sg Sb MStart
  71.           PARSE VAR MLast  x Er Eg Eb MLast
  72.           r=Sr+(Er-Sr)*fa
  73.           g=Sg+(Eg-Sg)*fa
  74.           b=Sb+(Eb-Sb)*fa
  75.           List=List x TRUNC(r) TRUNC(g) TRUNC(b)
  76.           l=l+1
  77.         END
  78.         SetColor List
  79.         Record COPS
  80.         IF RC~=0 THEN LEAVE
  81.         From=From+1
  82.       END
  83.  
  84.       LEAVE
  85.     END
  86.   END
  87.   ELSE Message "'For a Colour Sequence at''least 2 Frames must be selected.'"
  88.  
  89.   FailAt AltFail
  90. exit
  91.