summaryrefslogtreecommitdiff
path: root/tex/context/modules/mkiv/s-present-weird.mkiv
blob: 641c3d979c47439f001bf71b4908cdb5d00a853f (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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
%D \module
%D   [      file=s-present-weird, % s-pre-17,
%D        version=1999.08.20,
%D          title=\CONTEXT\ Style File,
%D       subtitle=Presentation Environment Weird,
%D         author=Hans Hagen,
%D           date=\currentdate,
%D      copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.

\startmodule[present-balls]

%D This is a rather old style, adn I used it for a presentation about \MATHML\
%D around the turn of the century. Unfortunately I can't find back that weird
%D presentation. I didn't change the code apart from loading the body font. One can
%D clock on an area and get it large. Clicking elsewhere brings back the main page.
%D It was actualy a zoom test at that time.

\setupbodyfont
  [dejavu,11pt,ss]

\setupsystem
  [random=medium]

\setupbackgrounds
  [state=repeat]

\setupbackgrounds
  [page]
  [background={page,forward}]

\setupbackgrounds
  [text][text]
  [background=blowdown]

\setupinteraction
  [state=start,
 % click=off,
   color=TitleColor,
   contrastcolor=TitleColor]

\setupinteractionscreen
  [option=max]

\setuptolerance
  [verytolerant,stretch]

\definecolor [BackColor]  [s=.30]
\definecolor [PageColor]  [g=1]
\definecolor [FrameColor] [r=1]
\definecolor [TitleColor] [y=1]
\definecolor [ArrowColor] [b=1]

\defineoverlay [title]    [\useMPgraphic{title}]
\defineoverlay [page]     [\useMPgraphic{page}]
\defineoverlay [blowup]   [{\hboxreference[whatever:\CurrentBlaBla]{\overlaybutton{whatever:\CurrentBlaBla}}}]
\defineoverlay [blowdown] [{\hboxreference[page:\realfolio]{\overlaybutton{page:\realfolio}}}]
\defineoverlay [forward]  [\overlaybutton{forward}]

\startMPpositiongraphic{mppos:connection}
    path pa, pb, pc ; pair ca, cb ;
    initialize_box(\MPpos{\MPvar{self}}) ; pa := pxy ; ca := cxy ;
    initialize_box(\MPpos{\MPvar{prev}}) ; pb := pxy ; cb := cxy ;
    pickup pencircle scaled .5pt ;
    pa := pa enlarged 10pt ;
    pb := pb enlarged 10pt ;
    for i=1 upto 10 :
        draw pa randomized 20pt withcolor \MPcolor{FrameColor} ;
    endfor ;
    if \MPp{\MPvar{prev}} > 0 :
        pair a, b, c, d ;
        for i=1 upto 25 :
            a := .5[ulcorner pa,urcorner pa] randomized (10pt,10pt) ;
            b := .5[llcorner pb,lrcorner pb] randomized (20pt,10pt) ;
            c := .5[a,b] rotatedaround(a,-25) randomized (5pt,5pt) ;
            d := .5[a,b] rotatedaround(a,+25) randomized (5pt,5pt) ;
            draw (a--b) withcolor \MPcolor{ArrowColor} ;
            draw (d--a--c) withcolor \MPcolor{ArrowColor} ;
        endfor ;
    fi ;
    anchor_box(\MPanchor{\MPvar{self}}) ;
\stopMPpositiongraphic

\startuseMPgraphic{title}
    pickup pencircle scaled .5pt ;
    for i=1 upto 10 :
        draw fullsquare
            xyscaled(OverlayWidth,OverlayHeight)
            enlarged 10pt randomized 20pt
            withcolor \MPcolor{TitleColor} ;
    endfor ;
\stopuseMPgraphic

\startuseMPgraphic{page}
    StartPage ;
        pickup pencircle scaled .5pt ;
        fill Page withcolor \MPcolor{BackColor} ;
        for i=1 upto 20 :
            draw Page enlarged -50pt randomized 50pt withcolor \MPcolor{PageColor} ;
        endfor ;
    StopPage ;
\stopuseMPgraphic

\newcounter\CurrentBlaBla

\defineframedtext
   [ZoomText]
   [before=,
    after=,
    width=fit,
    align=flushleft,
    frame=off,
    foregroundcolor=white]

\starttexdefinition StartText
    \begingroup
    \getrandomdimen\scratchdimen{250pt}{350pt}
    \edef\TextWidth{\the\scratchdimen}
    \setbox\scratchbox\hbox\bgroup
        \hsize\TextWidth
        \ZoomText\bgroup
\stoptexdefinition

\starttexdefinition StartTextSimple
    \begingroup
    \setbox\scratchbox\hbox\bgroup
        \framed [
            frame=off,
            foregroundcolor=white
        ]
        \bgroup
\stoptexdefinition

\starttexdefinition StopTextSimple
    \StopText
\stoptexdefinition

\starttexdefinition StopText
        \egroup
    \egroup
    \doglobal\increment\CurrentBlaBla
    \let\PrevBlaBla\CurrentBlaBla \doglobal\decrement\PrevBlaBla
    \let\NextBlaBla\CurrentBlaBla \doglobal\increment\NextBlaBla
    \setMPpositiongraphic {
        connection:\CurrentBlaBla
    }{
        mppos:connection
    }{
        seed=\CurrentBlaBla,
        prev=connection:\PrevBlaBla,
        next=connection:\NextBlaBla
    }
    \hbox to 600pt \bgroup
        \setupinteraction[focus=frame]
        \getrandomdimen\scratchdimen{50pt}{75pt}
        \hskip0pt plus \scratchdimen minus \scratchdimen
        \hpos {
            connection:\CurrentBlaBla
        }{
            \framed [
                frame=off,
                offset=overlay,
                backgroundoffset=50pt,
                background=blowup
            ] {
                \box\scratchbox
            }
        }
        \getrandomdimen\scratchdimen{50pt}{75pt}
        \hskip0pt plus \scratchdimen minus \scratchdimen
    \egroup
    \getrandomdimen\scratchdimen{75pt}{125pt}
    \vskip\scratchdimen
    \endgroup
\stoptexdefinition

\dontcomplain

\disablemode[SpreadPage]

\starttexdefinition StartPage #1
    \doglobal\increment(\CurrentBlaBla,100)%
    \setvariables[StartPage][title={#1}]
    \setbox\scratchbox\hbox\bgroup
        \valign\bgroup
            \ignorespaces
            \alignmark\alignmark
            \vss
            \cr
\stoptexdefinition

\starttexdefinition StopPage
    \cr
    \egroup
    \egroup
    \setbox\scratchbox\vbox\bgroup
        \vskip100pt
        \doifelsemode {SpreadPage} {
            \hbox spread 200pt
        } {
            \hbox to \wd\scratchbox
        }
        \bgroup
            \setupinteraction[focus=frame]
            \hss
            \switchtobodyfont[big]%
            \bfd
            \doglobal\increment\CurrentBlaBla
            \setupinterlinespace
            \hpos {
                title:\realfolio
            }{
                \framed [
                    frame=off,
                    offset=overlay,
                    backgroundoffset=50pt,
                    background=blowup
                ] {
                    \framed [
                        frame=off,
                        align=middle,
                        foregroundcolor=white,
                        background=title
                    ] {
                        \getvariable{StartPage}{title}
                    }
                }
            }
            \hss
        \egroup
        \vskip100pt
        \box\scratchbox
    \egroup
    \normalexpanded {
        \definepapersize [
            MasterPage
        ] [
            width=\the\dimexpr\wd\scratchbox+100pt\relax,
            height=\the\dimexpr\ht\scratchbox+\dp\scratchbox+100pt\relax
        ]
    }
    \setuppapersize
        [MasterPage]
        [MasterPage]
    \setuplayout [
        topspace=50pt,
        backspace=50pt,
        width=middle,
        header=0pt,
        footer=0pt,
        height=middle
    ]
    \centerbox {
        \box\scratchbox
    }
   \page
\stoptexdefinition

\starttexdefinition StartTopic #1
    \removeunwantedspaces
    \cr
    \doglobal\increment(\CurrentBlaBla,100)%
    \vbox\bgroup
        \vskip100pt
        \bgroup
            \definecolor[FrameColor][TitleColor]
            \switchtobodyfont[big]
            \bfd
            \setupinterlinespace
            \StartTextSimple
                \ignorespaces
                #1
                \removeunwantedspaces
            \StopTextSimple
            \vskip25pt
        \egroup
\stoptexdefinition

\starttexdefinition StopTopic
    \vskip-\lastskip
    \vskip100pt
    \egroup
    \ignorespaces
\stoptexdefinition

\starttexdefinition TitlePage #1
    \begingroup
        \enforced\protected\def\\{\vskip1ex\bfc\def\\{\vskip1ex\bfb}}
        \enablemode[SpreadPage]
        \StartPage{#1}
        \StopPage
    \endgroup
\stoptexdefinition

\stopmodule

\continueifinputfile{s-present-balls.mkiv}

\inputpresentationfile{examples/present-weird-001.tex}