ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Peter Rolf <indiego@gmx.net>
Subject: Re: Fielstack and Layers for Presentation
Date: Sat, 14 Oct 2006 12:12:31 +0200	[thread overview]
Message-ID: <4530B80F.3050103@gmx.net> (raw)
In-Reply-To: <45300B19.3020203@nibua-r.org>

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@ntg.nl
> http://www.ntg.nl/mailman/listinfo/ntg-context
> 
> 

  reply	other threads:[~2006-10-14 10:12 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
2006-10-14 10:12   ` Peter Rolf [this message]
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=4530B80F.3050103@gmx.net \
    --to=indiego@gmx.net \
    --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).