[NTG-context] Fielstack and Layers for Presentation

Peter Rolf indiego at gmx.net
Sat Oct 14 12:12:31 CEST 2006


Hi Renaud,

I tried your example code and it is really fun. But you should exchange
the buffers with setups to minimize runtime. On my machine it's 4x
faster this way. I'll better not imagine, how often you have compiled
your example code, before it reached this nice and clean state ;)

Renaud AUBIN wrote:
> 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...
>
What I can think of is to initialize the random seed value of MP (name?)
with the same value, every time before you fill a new layer. Another way
would be to add the 'random' parameters to your FrameTitle macro. But I
don't have much experience with random stuff, so there maybe better ways.

Greetings, Peter

> 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
> 
> _______________________________________________
> ntg-context mailing list
> ntg-context at ntg.nl
> http://www.ntg.nl/mailman/listinfo/ntg-context
> 
> 



More information about the ntg-context mailing list