summaryrefslogtreecommitdiff
path: root/graphics/MF-PS/mftoeps/m2esamp/sample4.mf
blob: 37acefb4d05233fe3d13c944a15be281084b5cd9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
%%%%
%%%% This file belongs to the MFTOEPS package.
%%%%
% ---
% SAMPLE4.MF
% ---
input mftoeps;
input polygons;
eps_mode_setup;
% ---
def write_paths(expr name) =
  find_BB elem_path1;
  write_preamble name;
  for i:=1 upto objects:
   coeff:=
    if objects=1: 0 else: .5(1-cosd(((i-1)/(objects-1))[alpha1,alpha2])) fi;
   fix_fill_cmyk forsuffixes $:=cyan, magenta, yellow: coeff[$1,$2], endfor
    coeff[black1,black2];
   fill_C elem_path[i];
  endfor;
  write_postamble;
enddef;
% ---
ch_max:=3;
% ---
for ch:=0 upto ch_max:
 beginchar(char(ASCII("a")+ch), 1in#, 1in#, 0);
  path elem_path[\\];
  objects:=100; transitions:=.5; % regular 2
  sca1:=w; sca2:=.05w;
  rot1:=0; rot2:=(ch/ch_max)[0,-360];
  alpha1:=0; alpha2:=transitions*360;
  cyan1:=0; magenta1:=0; yellow1:=0; black1:=0.05;
  cyan2:=0; magenta2:=0; yellow2:=0; black2:=0.9;
  for i:=1 upto objects:
   coeff:=if objects=1: 0 else: (i-1)/(objects-1) fi;
   elem_path[i]:= flex_polygon(6,(coeff**.1)[-30,0],(coeff**.1)[30,0])
    scaled (coeff[sca1,sca2])
    rotated (coeff[rot1,rot2]+30) shifted (.5w,.5h);
  endfor
  write_paths(jobname & char(ASCII("a")+ch));
 endchar;
endfor
% ---
end.