Home | Download | Documents | Tips & Tutorials | Code Library | Help / User Group | Order

 

Alf's Pattern Examples #2


Wavy Patterns | Zig Zag Patterns | Line Patterns

2. Zig Zag Patterns

From: Alfredo Mateus <almateus@globalsite.com.br>
To: fm@lists.best.com
Subject: FM: zig zagging
Date: Saturday, March 06, 1999 3:35 PM

Hi all, these are other patterns in the series. Some nice zig zag
patterns and the more common stripes. The last one was not adapted for
the multiple modes.

Alf


2.1 Step One

Copy and paste the following FF+ code into the FM source window.  Save the source code as file patterns-zigzag.ffp.  Then Compile and run the filter!

%FFP

Category   :"Alf's Power Toys"
Title      :"Patterns - Zig Zag"
Copyright  :"Copyright 1999 by almateus@globalsite.com.br"
Author     :"Alfredo Mateus"
Filename   :"Pattern.8bf"
Description:"Created based on multi-filter example by Alex Hunter"
Version    :"1.0"

// Interface for the Miscellaneous Pattern Set

//Dialog goes here

// Control definitions:

ctl(0):"",val=50,range=(1,100),pos=(170,5),size=(80,6)
ctl(1):"",val=50,range=(1,100),pos=(170,14),size=(80,6)
ctl(2):"",val=4,range=(1,16),pos=(280,5),size=(80,6)

ctl(51):RADIOBUTTON(GROUP,TABSTOP),"",pos=(180,30),size=(40,8),action=preview,val=1
ctl(52):RADIOBUTTON,"",pos=(180,60),size=(50,8),action=preview
ctl(53):RADIOBUTTON,"",pos=(180,90),size=(50,8),action=preview
ctl(54):RADIOBUTTON,"",pos=(240,90),size=(50,8),action=preview
ctl(55):RADIOBUTTON,"",pos=(240,30),size=(40,8),action=preview
ctl(56):RADIOBUTTON,"",pos=(240,60),size=(40,8),action=preview
ctl(57):RADIOBUTTON,"",pos=(290,30),size=(50,8),action=preview
ctl(58):RADIOBUTTON,"",pos=(290,60),size=(50,8),action=preview
ctl(59):RADIOBUTTON,"",pos=(290,90),size=(50,8),action=preview

ctl(60):GROUPBOX(GROUP),pos=(176,20),size=(158,98)

ctl(10) : COMBOBOX(dropdown),
pos=(335,30),size=(50,82),text="Normal\nMultiply\nScreen\nDifference",action=preview
 

ForEveryTile:{

  if (doingProxy) {
    int choice, previousChoice;
    // Determine the current radio button selection,
    // save it in the GROUPBOX, and see if it changed...
    if (ctl(51)) choice = 1;
    else if (ctl(52)) choice = 2;
    else if (ctl(53)) choice = 3;
    else if (ctl(54)) choice = 4;
    else if (ctl(55)) choice = 5;
    else if (ctl(56)) choice = 6;
    else if (ctl(57)) choice = 7;
    else if (ctl(58)) choice = 8;
    else choice = 9;

    previousChoice = setCtlVal(60, choice);

    if (choice != previousChoice) {
      // Alter the User Interface as necessary
      if (ctl(51)) {
        // Vertical
        setDialogText("Vertical");
        setCtlText(0, ""); setCtlVal(10,0);
      }
      else if (ctl(52)) {
        // Horizontal
        setDialogText("Horizontal");
        setCtlText(0, ""); setCtlVal(10,0);
      }
      else if (ctl(53)) {
        // Diagonal 1
        setDialogText("Diagonal 1");
        setCtlText(0, ""); setCtlVal(10,0);
      }
      else if (ctl(54)) {
        // Diagonal 2
        setDialogText("Diagonal 2");
        setCtlText(0, ""); setCtlVal(10,0);
      }
      else if (ctl(55)) {
        // Rings
        setDialogText("Rings");
        setCtlText(0, ""); setCtlVal(10,0);
      }
      else if (ctl(56)) {
        // Radial
        setDialogText("Zig Zag Checkers Diagonal");
        setCtlText(0, ""); setCtlVal(10,0);
      }
      else if (ctl(57)) {
        // Checkers
        setDialogText("Zig Zag Checkers Vertical");
        setCtlText(0, ""); setCtlVal(10,0);
      }
      else if (ctl(58)) {
        // Diag. Checkers
        setDialogText("Zig Zag Checkers Horizontal");
        setCtlText(0, ""); setCtlVal(0,
32);setCtlVal(2,8);setCtlVal(10,0);
      }
      else {
        // Tangram
        setDialogText("Tangram");
        setCtlText(0, ""); setCtlVal(10,0);
      }
    }//if choice changed
  }//if doingProxy
  false; //doForEveryRow
} //ForEveryTile

//////////////////// Vertical ////////////////////

R: ctl(51) ? put(cos(scl(x,0,X,-512*val(0,1,25),512*val(0,1,25))),1),
             put(cos(scl(y,0,Y,-512*val(0,1,25),512*val(0,1,25))),2),
             put(sin(scl(y-x,0,Y,-512*val(0,1,25),512*val(0,1,25))),3),
             put(sin(scl(x+y,0,Y,-512*val(0,1,25),512*val(0,1,25))),4),
             put(get(2)-get(1),5),put(get(1)+get(2),6),
             put(get(5)+get(6)>0?get(3)>0?0:255:get(4)>=0?0:255,11),
 
ctl(10)==3?abs(get(11)-c):ctl(10)==2?255-((255-get(11))*(255-c))/255:ctl(10)==1?get(11)*c/255:get(11)
             : R

G: ctl(51) ?
ctl(10)==3?abs(get(11)-c):ctl(10)==2?255-((255-get(11))*(255-c))/255:ctl(10)==1?get(11)*c/255:get(11):
G

B: ctl(51) ?
ctl(10)==3?abs(get(11)-c):ctl(10)==2?255-((255-get(11))*(255-c))/255:ctl(10)==1?get(11)*c/255:get(11):
B

A:a

//////////////////// Horizontal ////////////////////
R: ctl(52) ? put(cos(scl(x,0,X,-512*val(0,1,25),512*val(0,1,25))),1),
             put(cos(scl(y,0,Y,-512*val(0,1,25),512*val(0,1,25))),2),
             put(sin(scl(y-x,0,Y,-512*val(0,1,25),512*val(0,1,25))),3),
             put(sin(scl(x+y,0,Y,-512*val(0,1,25),512*val(0,1,25))),4),
             put(get(1)-get(2),5),put(get(1)+get(2),6),
 
put(get(5)+get(6)>0?get(3)<0?0:255:get(4)>=0?0:255,11),
 
ctl(10)==3?abs(get(11)-c):ctl(10)==2?255-((255-get(11))*(255-c))/255:ctl(10)==1?get(11)*c/255:get(11)
             : R
 
G: ctl(52) ?
ctl(10)==3?abs(get(11)-c):ctl(10)==2?255-((255-get(11))*(255-c))/255:ctl(10)==1?get(11)*c/255:get(11)
: G

B: ctl(52) ?
ctl(10)==3?abs(get(11)-c):ctl(10)==2?255-((255-get(11))*(255-c))/255:ctl(10)==1?get(11)*c/255:get(11)
: B

A:a

//////////////////// Zig Zag Diagonal 1 ////////////////////

R: ctl(53) ? put(sin(scl(x,0,X,-512*val(0,1,25),512*val(0,1,25))),1),
             put(sin(scl(y,0,Y,-512*val(0,1,25),512*val(0,1,25))),2),
 
put(sin(scl(+y+x,0,X+Y,-512*val(0,1,25),512*val(0,1,25))),4),
             put(get(4)>0?get(2)>0?255:0:get(1)>0?0:255,9),
 
ctl(10)==3?abs(get(9)-c):ctl(10)==2?255-((255-get(9))*(255-c))/255:ctl(10)==1?get(9)*c/255:get(9)
             : R

G: ctl(53) ?
ctl(10)==3?abs(get(9)-c):ctl(10)==2?255-((255-get(9))*(255-c))/255:ctl(10)==1?get(9)*c/255:get(9)
: G

B: ctl(53) ?
ctl(10)==3?abs(get(9)-c):ctl(10)==2?255-((255-get(9))*(255-c))/255:ctl(10)==1?get(9)*c/255:get(9)
: B

A:a

//////////////////// Zig Zag Diagonal 2 ///////////////
R: ctl(54) ? put(sin(scl(x,0,X,-512*val(0,1,25),512*val(0,1,25))),1),
             put(sin(scl(y,0,Y,-512*val(0,1,25),512*val(0,1,25))),2),
         put(sin(scl(-y+x,-X,+Y,-512*val(0,1,25),512*val(0,1,25))),4),
 
put(get(4)>0?get(2)<0?255:0:get(1)>0?0:255,9),ctl(10)==3?abs(get(9)-c):ctl(10)==2?255-((255-get(9))*(255-c))/255:ctl(10)==1?get(9)*c/255:get(9)
             : R

G: ctl(54) ?
ctl(10)==3?abs(get(9)-c):ctl(10)==2?255-((255-get(9))*(255-c))/255:ctl(10)==1?get(9)*c/255:get(9)
: G

B: ctl(54) ?
ctl(10)==3?abs(get(9)-c):ctl(10)==2?255-((255-get(9))*(255-c))/255:ctl(10)==1?get(9)*c/255:get(9)
: B

A:a

//////////////////// Diagonal Arrows ///////////////
R: ctl(55) ? put(cos(scl(x,0,X,-512*val(0,1,25),512*val(0,1,25))),1),
             put(cos(scl(y,0,Y,-512*val(0,1,25),512*val(0,1,25))),2),
             put(sin(scl(y-x,0,Y,-512*val(0,1,25),512*val(0,1,25))),3),
             put(sin(scl(x+y,0,Y,-512*val(0,1,25),512*val(0,1,25))),4),
             put(get(3)-get(4),5),put(get(3)+get(4),6),
             put(get(5)+get(6)>0?get(1)<0?0:255:get(2)>=0?0:255,9),
 
ctl(10)==3?abs(get(9)-c):ctl(10)==2?255-((255-get(9))*(255-c))/255:ctl(10)==1?get(9)*c/255:get(9)
             : R

G: ctl(55) ?
ctl(10)==3?abs(get(9)-c):ctl(10)==2?255-((255-get(9))*(255-c))/255:ctl(10)==1?get(9)*c/255:get(9)
: G

B: ctl(55) ?
ctl(10)==3?abs(get(9)-c):ctl(10)==2?255-((255-get(9))*(255-c))/255:ctl(10)==1?get(9)*c/255:get(9)
: B

A:a

//////////////////// Zig Zag Checkers Diagonal ///////////////
R: ctl(56) ? put(sin(scl(x,0,X,-512*val(0,1,25),512*val(0,1,25))),1),
             put(sin(scl(y,0,Y,-512*val(0,1,25),512*val(0,1,25))),2),
 
put(sin(scl(+y-x,-X,Y,-512*val(0,1,25),512*val(0,1,25))),3),
 
put(sin(scl(x+y,0,X+Y,-512*val(0,1,25),512*val(0,1,25))),4),
             put(get(3)>0?get(2)>0?255:0:get(1)>0?0:255,9),
 
ctl(10)==3?abs(get(9)-c):ctl(10)==2?255-((255-get(9))*(255-c))/255:ctl(10)==1?get(9)*c/255:get(9)
             : R

G: ctl(56) ?
ctl(10)==3?abs(get(9)-c):ctl(10)==2?255-((255-get(9))*(255-c))/255:ctl(10)==1?get(9)*c/255:get(9)
: G

B: ctl(56) ?
ctl(10)==3?abs(get(9)-c):ctl(10)==2?255-((255-get(9))*(255-c))/255:ctl(10)==1?get(9)*c/255:get(9)
: B

A:a

//////////////////// Zig Zag Checkers Vertical///////////////
R: ctl(57) ? put(sin(scl(x,0,X,-512*val(0,1,25),512*val(0,1,25))),1),
             put(sin(scl(y,0,Y,-512*val(0,1,25),512*val(0,1,25))),2),
 
put(sin(scl(+y-x,-X,Y,-512*val(0,1,25),512*val(0,1,25))),3),
 
put(sin(scl(x+y,0,X+Y,-512*val(0,1,25),512*val(0,1,25))),4),
             put(get(1)>0?get(3)>0?255:0:get(4)>0?0:255,9),
 
ctl(10)==3?abs(get(9)-c):ctl(10)==2?255-((255-get(9))*(255-c))/255:ctl(10)==1?get(9)*c/255:get(9)
             : R

G: ctl(57) ?
ctl(10)==3?abs(get(9)-c):ctl(10)==2?255-((255-get(9))*(255-c))/255:ctl(10)==1?get(9)*c/255:get(9)
: G

B: ctl(57) ?
ctl(10)==3?abs(get(9)-c):ctl(10)==2?255-((255-get(9))*(255-c))/255:ctl(10)==1?get(9)*c/255:get(9)
: B

A:a

//////////////////// Zig Zag Checkers Horiz. ///////////////

R: ctl(58) ? put(sin(scl(x,0,X,-512*val(0,1,25),512*val(0,1,25))),1),
             put(sin(scl(y,0,Y,-512*val(0,1,25),512*val(0,1,25))),2),
 
put(sin(scl(+y-x,-X,Y,-512*val(0,1,25),512*val(0,1,25))),3),
 
put(sin(scl(x+y,0,X+Y,-512*val(0,1,25),512*val(0,1,25))),4),
             put(get(2)>0?get(3)>0?255:0:get(4)>0?0:255,9),
 
ctl(10)==3?abs(get(9)-c):ctl(10)==2?255-((255-get(9))*(255-c))/255:ctl(10)==1?get(9)*c/255:get(9)
             : R

G: ctl(58) ?
ctl(10)==3?abs(get(9)-c):ctl(10)==2?255-((255-get(9))*(255-c))/255:ctl(10)==1?get(9)*c/255:get(9)
: G

B: ctl(58) ?
ctl(10)==3?abs(get(9)-c):ctl(10)==2?255-((255-get(9))*(255-c))/255:ctl(10)==1?get(9)*c/255:get(9)
: B

A:a

//////////////////// Tangram ///////////////

R: ctl(59) ? put(sin(scl(x,0,X,-512*val(0,1,25),512*val(0,1,25))),1),
             put(sin(scl(y,0,Y,-512*val(0,1,25),512*val(0,1,25))),2),
 
put(sin(scl(y-x,Y-X,Y,-512*val(0,1,25),512*val(0,1,25))),3),
 
put(sin(scl(x+y,0,X+Y,-512*val(0,1,25),512*val(0,1,25))),4),
             put(min(get(1),get(2)),5),
             put(max(get(1),get(2)),6),
             put(get(1)-get(2)>0?get(3)>=0?255:0:get(4)>=0?0:255,9),
 
ctl(10)==3?abs(get(9)-c):ctl(10)==2?255-((255-get(9))*(255-c))/255:ctl(10)==1?get(9)*c/255:get(9)
             : R

G: ctl(59) ?
ctl(10)==3?abs(get(9)-c):ctl(10)==2?255-((255-get(9))*(255-c))/255:ctl(10)==1?get(9)*c/255:get(9)
: G

B: ctl(59) ?
ctl(10)==3?abs(get(9)-c):ctl(10)==2?255-((255-get(9))*(255-c))/255:ctl(10)==1?get(9)*c/255:get(9)
: B

A:a



Wavy Patterns | Zig Zag Patterns | Line Patterns

 

Home | Download | Documents | Tips & Tutorials | Code Library | Help / User Group | Order