From: Renaud AUBIN <aubin@nibua-r.org>
Subject: Re: Fielstack and Layers for Presentation
Date: Fri, 13 Oct 2006 23:54:33 +0200 [thread overview]
Message-ID: <45300B19.3020203@nibua-r.org> (raw)
In-Reply-To: <452E823F.6040503@nibua-r.org>
Hi all,
After several trial-error experiments, I obtained what I want with the
attached code. I use only one background for the frames within
definesymbol because the use of several background "failed" (only the
last one is eventually displayed). Now, I would like to know if it is
possible to obtain a deterministic random-like shapes, i.e. to get
always the same shape for Overlay1...
Renaud
PS: Thanks to Peter, Andrea and Hans for the thread absolute positioning
of figures ;)
\setupcolors[state=start]
\usemodule[pre-original]
\defineoverlay[FunnyFrame][\useMPgraphic{FunnyFrame}]
\defineframedtext[FunnyText][frame=off,background=FunnyFrame]
\def\StartFrame{\startFunnyText}
\def\StopFrame {\stopFunnyText }
\def\FrameTitle#1%
{\setMPtext{FunnyFrame}{\hbox spread 1em{\hss\strut#1\hss}}}
\setMPtext{FunnyFrame}{\hbox spread 1em{\hss\strut{TEST}\hss}} %
initialize the text variable
\startuseMPgraphic{FunnyFrame}
picture p ; numeric o ; path a, b ; pair c ;
p := textext.rt(\MPstring{FunnyFrame}) ;
a := unitsquare xyscaled(OverlayWidth,OverlayHeight) ;
o := BodyFontSize ;
p := p shifted (2o,OverlayHeight-ypart center p) ;
drawoptions (withpen pencircle scaled 1pt withcolor .625red) ;
b := a randomized (o/2) ;
fill b withcolor .85white ; draw b ;
c := center p ;
c := b intersectionpoint (c shifted (0,-o)--c shifted(0,o)) ;
p := p shifted (c-center p) ;
b := (boundingbox p) randomized (o/8) ;
fill b withcolor .85white ; draw b ;
draw p withcolor black;
setbounds currentpicture to a ;
\stopuseMPgraphic
\starttext
\Topic{Stacks \& Layers}
\startbuffer[buf1]
\FrameTitle{Overlay1}
\StartFrame[width=.75\textwidth]
This is the first funny frame !
\StopFrame
\stopbuffer
\startbuffer[buf2]
\FrameTitle{Overlay2}
\StartFrame[width=.75\textwidth]
This is the second funny frame !
\StopFrame
\stopbuffer
\startbuffer[buf3]
\FrameTitle{Overlay3}
\StartFrame[width=.75\textwidth]
This is the third funny frame !
\StopFrame
\stopbuffer
\definelayer[layer1][]
\definelayer[layer2][]
\definelayer[layer3][]
\setlayer[layer1][x=.05\textwidth,y=.05\textheight,location=br]{\getbuffer[buf1]}
\setlayer[layer2][x=.05\textwidth,y=.05\textheight,location=br]{\getbuffer[buf1]}
\setlayer[layer2][x=.1\textwidth,y=.1\textheight,location=br]{\getbuffer[buf2]}
\setlayer[layer3][x=.05\textwidth,y=.05\textheight,location=br]{\getbuffer[buf1]}
\setlayer[layer3][x=.1\textwidth,y=.1\textheight,location=br]{\getbuffer[buf2]}
\setlayer[layer3][x=.15\textwidth,y=.15\textheight,location=br]{\getbuffer[buf3]}
\defineoverlay[overlay1][{\placelayer[layer1]}]
\defineoverlay[overlay2][{\placelayer[layer2]}]
\defineoverlay[overlay3][{\placelayer[layer3]}]
\definesymbol[one][{\framed[width=\textwidth,height=.3\textheight,background=overlay1,frame=off]{}}]
\definesymbol[two][{\framed[width=\textwidth,height=.3\textheight,background=overlay2,
align=right,frame=off]{}}]
\definesymbol[three][{\framed[width=\textwidth,height=.3\textheight,background=overlay3,
align=right,frame=off]{}}]
\definefieldstack[sequence][one,two,three][height=fit,width=fit,frame=off,offset=overlay,clickin=JS(Walk_Field{sequence})]
{{\fieldstack[sequence]}}
\goto{next}[JS(Walk_Field{sequence})]
\stoptext
next prev parent reply other threads:[~2006-10-13 21:54 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-12 17:58 Renaud AUBIN
2006-10-13 13:38 ` Peter Rolf
2006-10-13 21:54 ` Renaud AUBIN [this message]
2006-10-14 10:12 ` Peter Rolf
2006-10-15 20:14 ` Renaud AUBIN
2006-10-14 17:40 ` Hans Hagen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=45300B19.3020203@nibua-r.org \
--to=aubin@nibua-r.org \
--cc=ntg-context@ntg.nl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).