104 |
draw lnk[ind].e.p transformed lnk[ind].e.loc withpen pencircle scaled 4pt; |
draw lnk[ind].e.p transformed lnk[ind].e.loc withpen pencircle scaled 4pt; |
105 |
enddef; |
enddef; |
106 |
|
|
107 |
vardef plainlink(expr ind) = |
vardef plainlink(expr ind, offs) = |
108 |
locatelinkend(a, ind); |
locatelinkend(a, ind); |
109 |
locatelinkend(b, ind); |
locatelinkend(b, ind); |
110 |
plainlinkend(a, ind) |
plainlinkend(a, ind) |
111 |
plainlinkend(b, ind) |
plainlinkend(b, ind) |
112 |
draw ((0,0) transformed lnk[ind].a.loc){right} .. tension 1.5 .. |
save la, lb; |
113 |
((0,0) transformed lnk[ind].b.loc){right} withpen pencircle scaled 6pt; |
pair la,lb; |
114 |
|
la = (0,0) transformed lnk[ind].a.loc; |
115 |
|
lb = (0,0) transformed lnk[ind].b.loc; |
116 |
|
draw la{right} .. tension .75 and .75 .. .5[la,lb] + offs {lb-la} |
117 |
|
.. tension .75 and .75 .. lb{right} |
118 |
|
withpen pencircle scaled 6pt; |
119 |
enddef; |
enddef; |
120 |
|
|
121 |
def cir(expr x, y, r) = |
def cir(expr x, y, r) = |
158 |
|
|
159 |
beginfig(1); |
beginfig(1); |
160 |
|
|
161 |
|
spacing = 25; |
162 |
|
bscale = .85; |
163 |
|
|
164 |
docpic(a, identity); |
docpic(a, identity); |
165 |
docpic(b, identity shifted (a.loc + (0, -ypart(b.size)-50))); |
%docpic(b, identity shifted (a.loc + (0, -ypart(b.size)-50))); |
166 |
docpic(c, identity shifted (b.loc + (xpart(b.size)+50, 0))); |
%docpic(c, identity shifted (b.loc + (xpart(b.size)+50, 0))); |
167 |
docpic(d, identity shifted (b.loc + (0, -400))); |
%docpic(d, identity shifted (b.loc + (0, -400))); |
168 |
docpic(e, identity shifted (d.loc + (xpart(d.size)+50, 0))); |
%docpic(e, identity shifted (d.loc + (xpart(d.size)+50, 0))); |
169 |
|
docpic(b, identity scaled bscale shifted (a.loc + (xpart(a.size)+spacing, 0))); |
170 |
|
docpic(c, identity shifted (b.loc + (bscale * xpart(b.size)+spacing, 0))); |
171 |
|
docpic(d, identity shifted (c.loc + (xpart(c.size)+spacing, 0))); |
172 |
|
docpic(e, identity shifted (d.loc + (xpart(d.size)+spacing, 0))); |
173 |
|
|
174 |
def doclabel(suffix d)(expr l) = |
def doclabel(suffix d)(expr l) = |
175 |
label.lrt(l infont defaultfont scaled 10 , d.loc + (0,ypart d.size)); |
label.lrt(l infont defaultfont scaled 10 , d.loc + (0,ypart d.size)); |
181 |
doclabel(d, "4"); |
doclabel(d, "4"); |
182 |
doclabel(e, "5"); |
doclabel(e, "5"); |
183 |
|
|
184 |
plainlink(0); |
plainlink(0, (0,-30)); |
185 |
plainlink(1); |
plainlink(1, (0,60)); |
186 |
plainlink(2); |
plainlink(2, (0,60)); |
187 |
plainlink(3); |
plainlink(3, (0, 120)); |
188 |
plainlink(4); |
plainlink(4, (0, -60)); |
189 |
|
|
190 |
% addto currentpicture also a.p; |
% addto currentpicture also a.p; |
191 |
% |
% |
200 |
|
|
201 |
endfig; |
endfig; |
202 |
|
|
203 |
|
ccx = 210; |
204 |
|
ccy = 160; |
205 |
cor = 20; |
cor = 20; |
206 |
path csp; |
path csp; |
207 |
csp = (-200, 0){up} ... (-200+cor, 150-cor) ... (0, 150){right}; |
csp = (-200, 0){up} ... (-200+cor, 150-cor) ... (0, 150){right}; |
208 |
csp := (csp & (reverse csp xscaled -1) ..(csp scaled -1) ..(reverse csp yscaled -1)) .. cycle ; |
csp := (csp & (reverse csp xscaled -1) ..(csp scaled -1) ..(reverse csp yscaled -1)) .. cycle ; |
209 |
|
path cbp; |
210 |
|
cbp = (-ccx,-ccy) -- (-ccx,ccy) -- (ccx, ccy) -- (ccx,-ccy) -- cycle ; |
211 |
|
|
212 |
ccx = 210; |
boolean fillcscreen; |
213 |
ccy = 160; |
fillcscreen = false; |
214 |
|
|
215 |
def cscreen = |
def cscreenkey = |
216 |
|
fillcscreen := true; |
217 |
|
enddef; |
218 |
|
vardef cscreen = |
219 |
clip currentpicture to csp; |
clip currentpicture to csp; |
220 |
|
if fillcscreen: |
221 |
|
save p; |
222 |
|
picture p; |
223 |
|
p := currentpicture; |
224 |
|
fill cbp withcolor black; |
225 |
|
fill csp withcolor white; |
226 |
|
addto currentpicture also p; |
227 |
|
fi |
228 |
draw csp withpen pencircle scaled 3pt; |
draw csp withpen pencircle scaled 3pt; |
229 |
draw (-ccx,-ccy) -- (-ccx,ccy) -- (ccx, ccy) -- (ccx,-ccy) -- cycle |
draw cbp withpen pencircle scaled 2pt;; |
230 |
withpen pencircle scaled 2pt;; |
fillcscreen := false; |
231 |
enddef; |
enddef; |
232 |
|
|
233 |
|
|
234 |
bboxmargin := 0pt; |
bboxmargin := 0pt; |
235 |
|
|
236 |
def atrans(expr e) = |
def atrans(expr e) = |
237 |
identity shifted(-50,-50) scaled (e[1.2, .7]) rotated (e*15) shifted (e[(0,0), (-150,25)]) |
identity shifted(-50,-50) scaled (e[1.2, .9]) rotated (e*15) shifted (e[(0,0), (-150,25)]) |
238 |
enddef; |
enddef; |
239 |
|
|
240 |
def aclip(expr e) = |
def aclip(expr e) = |
242 |
enddef; |
enddef; |
243 |
|
|
244 |
def ctrans(expr e) = |
def ctrans(expr e) = |
245 |
identity shifted (-lnk0b.l) scaled (e[.7,1.2]) rotated (e[-15,0]) shifted (e[(150,-60),(0,0)]) |
identity shifted (-lnk0b.l) scaled (e[.9,1.2]) rotated (e[-15,0]) shifted (e[(150,-60),(0,0)]) |
246 |
enddef; |
enddef; |
247 |
|
|
248 |
def cclip(expr e) = |
def cclip(expr e) = |
251 |
|
|
252 |
|
|
253 |
def btrans(expr e) = |
def btrans(expr e) = |
254 |
identity shifted (-lnk3b.l) scaled (e[.7,1.15]) rotated (e[-15,0]) |
identity shifted (-lnk3b.l) scaled (e[1.0,1.15]) rotated (e[-15,0]) |
255 |
shifted (e[(150, -70),(0,20)]) |
shifted (e[(150, -70),(0,20)]) |
256 |
enddef; |
enddef; |
257 |
def bclip(expr e) = |
def bclip(expr e) = |
289 |
|
|
290 |
enddef; |
enddef; |
291 |
|
|
|
|
|
|
% Initial position |
|
|
|
|
|
beginfig(2); |
|
|
aniframe(0); |
|
|
endfig; |
|
|
|
|
|
beginfig(3); |
|
|
aniframe(0.3); |
|
|
endfig; |
|
|
|
|
|
beginfig(4); |
|
|
aniframe(0.65); |
|
|
endfig; |
|
|
|
|
|
beginfig(5); |
|
|
aniframe(1.0); |
|
|
endfig; |
|
|
|
|
292 |
% Now, c starts to move away. |
% Now, c starts to move away. |
293 |
% Inverting the parameter to make change easier. |
% Inverting the parameter to make change easier. |
294 |
|
|
295 |
def ctrans(expr e) = |
def ctransii(expr e) = |
296 |
identity shifted (e[(-lnk3a.l),(-lnk0b.l)]) scaled (e[.7,1.2]) rotated (e[15,0]) shifted (e[(-150,-30),(0,0)]) |
identity shifted (e[(-lnk3a.l),(-lnk0b.l)]) scaled (e[.9,1.2]) rotated (e[15,0]) shifted (e[(-150,-30),(0,0)]) |
297 |
enddef; |
enddef; |
298 |
|
|
299 |
def cclip(expr e) = |
def cclipii(expr e) = |
300 |
lnk3a.p scaled (e[1.05, 5]) shifted lnk3a.l |
lnk3a.p scaled (e[1.05, 5]) shifted lnk3a.l |
301 |
enddef; |
enddef; |
302 |
|
|
303 |
|
def aniframeii(expr fract) = |
|
def aniframe(expr fract) = |
|
304 |
|
|
305 |
% link 0 |
% link 0 |
306 |
docpicclip(c, ctrans(1-fract), cclip(1-fract)); |
docpicclip(c, ctransii(1-fract), cclipii(1-fract)); |
307 |
docpicclip(b, btrans(fract), bclip(fract)); |
docpicclip(b, btrans(fract), bclip(fract)); |
308 |
if fract>.5: |
if fract>.5: |
309 |
fi; |
fi; |
320 |
linkline(2); |
linkline(2); |
321 |
|
|
322 |
docpicclip(a, |
docpicclip(a, |
323 |
identity shifted (-lnk1b.l) scaled .7 rotated -15 shifted (150,-50), |
identity shifted (-lnk1b.l) scaled 1.0 rotated -15 shifted (150,-50), |
324 |
lnk1b.p scaled 1.5 shifted lnk1b.l); |
lnk1b.p scaled 1.5 shifted lnk1b.l); |
325 |
linkline(1); |
linkline(1); |
326 |
|
|
327 |
fi; |
fi; |
328 |
|
|
329 |
|
|
330 |
linkline(3); |
linkline(3); |
331 |
cscreen; |
cscreen; |
332 |
enddef; |
enddef; |
333 |
|
|
334 |
beginfig(6); |
curframe = 2; |
335 |
aniframe(.3); |
|
336 |
endfig; |
def frames = |
|
beginfig(7); |
|
|
aniframe(.65); |
|
|
endfig; |
|
|
beginfig(8); |
|
|
aniframe(1); |
|
|
endfig; |
|
337 |
|
|
338 |
|
% Initial position |
339 |
|
|
340 |
|
beginfig(curframe); |
341 |
|
cscreenkey; |
342 |
|
aniframe(0); |
343 |
|
endfig; |
344 |
|
|
345 |
|
beginfig(curframe+1); |
346 |
|
aniframe(0.3); |
347 |
|
endfig; |
348 |
|
|
349 |
|
beginfig(curframe+2); |
350 |
|
aniframe(0.65); |
351 |
|
endfig; |
352 |
|
|
353 |
|
beginfig(curframe+3); |
354 |
|
cscreenkey; |
355 |
|
aniframe(1.0); |
356 |
|
endfig; |
357 |
|
|
358 |
|
beginfig(curframe+4); |
359 |
|
aniframeii(.3); |
360 |
|
endfig; |
361 |
|
beginfig(curframe+5); |
362 |
|
aniframeii(.65); |
363 |
|
endfig; |
364 |
|
beginfig(curframe+6); |
365 |
|
cscreenkey; |
366 |
|
aniframeii(1); |
367 |
|
endfig; |
368 |
|
|
369 |
|
curframe := curframe + 7; |
370 |
|
|
371 |
|
enddef; |
372 |
|
|
373 |
|
frames; |
374 |
|
frames; |
375 |
|
|
376 |
verbatimtex |
verbatimtex |
377 |
\end{document} |
\end{document} |