summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/metafont/mftoeps/m2esamp/sample3.mf
blob: c58756e37a6ac1c6a52ebe86a2010ccea2e9bbf9 (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
46
47
48
49
50
51
52
53
%%%%
%%%% This file belongs to the MFTOEPS package.
%%%%
% ---
% SAMPLE3.MF
% ---
input mftoeps;
input polygons;
eps_mode_setup;
% unpercent the following line if the coloured version is needed
% coloured:=1; 
% ---
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:=3;
  sca1:=w; sca2:=.02w;
  rot1:=0; rot2:=(ch/ch_max)[25,180];
  skew1:=45; skew2:=0;
  alpha1:=0; alpha2:=transitions*360;
  if known coloured:
   cyan1:=0; magenta1:=0; yellow1:=1; black1:=0;
   cyan2:=0.35294; magenta2:=0.8353; yellow2:=0.8353; black2:=0; % brown
  else:
   cyan1:=0; magenta1:=0; yellow1:=0; black1:=0.7;
   cyan2:=0; magenta2:=0; yellow2:=0; black2:=0.15;
  fi
  for i:=1 upto objects:
    coeff:=if objects=1: 0 else: (i-1)/(objects-1) fi;
    elem_path[i]:=flex_polygon(5,coeff[skew1,skew2],coeff[skew1,skew2])
      scaled (coeff[sca1,sca2])
    rotated (coeff[rot1,rot2]) shifted (.5w,.5h);
  endfor
  write_paths(jobname & char(ASCII("a")+ch));
 endchar;
endfor
% ---
end.