home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format 61 / af061a.adf / Macros / ColourSeq3P.clssa < prev    next >
Text File  |  1993-07-15  |  3KB  |  105 lines

  1. /***********************************************************************
  2.  GADGET: "'3 Colour Sequence'" "6" AUTO TYP: "?"
  3.  
  4.  $DAT >><< 01 May 1993 - (C) ProDAD Holger Burkarth
  5.  
  6.  This macro calculates a colour sequence in an animation. The
  7.  user selects a range as usual then a colour sequence is
  8.  calculated from the start to the end frame. In addition to this
  9.  the macro works with a sub-value which is calculated from the
  10.  current position. In this way a colour sequence can be created
  11.  with a transition colour.
  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>3 THEN DO
  24.  
  25.     DO FOREVER
  26.       GetAnimInfo
  27.       PARSE VAR RESULT . "FORMAT" x y t "VIEWMODE" ViewMode . "POS" CurPos .
  28.       ColNumber=2**t - 1
  29.  
  30.       MSRequester "TITLE '*** 3 Point Colour Sequence ***''Colour Sequence From "From" over "CurPos" To "To" ''Please select an Effect Mode.'",
  31.                   "PTEXT 'All Colours ...''Colour Range ...'"
  32.       IF RC~=0 THEN LEAVE
  33.       Art=RESULT
  34.  
  35.       IF Art=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 Art=2 THEN DO
  44.         COLRequest "FROM 0 TO 0 TITLE '*** 3 Point Colour Sequence ***'' ''Please select a colour range''for processing.'"
  45.         IF RC~=0 THEN LEAVE
  46.         List=RESULT
  47.       END
  48.  
  49.       ViewFrame COPS CurPos
  50.       IF RC~=0 THEN LEAVE
  51.       GetColor List
  52.       Parting=RESULT
  53.  
  54.       ViewFrame COPS To
  55.       IF RC~=0 THEN LEAVE
  56.       GetColor List
  57.       Last=RESULT
  58.  
  59.       ViewFrame COPS From
  60.       IF RC~=0 THEN LEAVE
  61.       GetColor List
  62.       Start=RESULT
  63.  
  64.       Number1=CurPos-From
  65.       Number2=To-CurPos+1
  66.  
  67.       DO UNTIL From>To
  68.         ViewFrame COPS From
  69.         IF RC~=0 THEN LEAVE
  70.  
  71.         IF From < CurPos THEN DO
  72.           MStart=Start
  73.           MLast=Parting
  74.           fa=(1-(CurPos-From)/Number1)
  75.         END; ELSE DO
  76.           MStart=Parting
  77.           MLast=Last
  78.           fa=((From-CurPos)/Number2)
  79.         END
  80.  
  81.         l=0
  82.         List=""
  83.         DO UNTIL MStart=""
  84.           PARSE VAR MStart x Sr Sg Sb MStart
  85.           PARSE VAR MLast  x Er Eg Eb MLast
  86.           r=Sr+(Er-Sr)*fa
  87.           g=Sg+(Eg-Sg)*fa
  88.           b=Sb+(Eb-Sb)*fa
  89.           List=List x TRUNC(r) TRUNC(g) TRUNC(b)
  90.           l=l+1
  91.         END
  92.         SetColor List
  93.         Record COPS
  94.         IF RC~=0 THEN LEAVE
  95.         From=From+1
  96.       END
  97.  
  98.       LEAVE
  99.     END
  100.   END
  101.   ELSE Message "'For a Colour Sequence at least''4 Frames must be selected.'"
  102.  
  103.   FailAt AltFail
  104. exit
  105.