490173b861ca1514f2344b3a6b6991d32437d76b
[hacks/simpleWebSlides.git] / doc / demo.xhtml
1 <?xml version="1.0" encoding="utf-8" ?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
3           "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
4 >
5 <html xmlns="http://www.w3.org/1999/xhtml">
6   <head>
7     <title>SimpleWebSlides</title>
8
9     <meta http-equiv="Content-Type"
10           content="text/html; charset=utf-8" />
11     <meta name="copyright"
12           content="Copyright &#169; 2013 Kim Nguyễn" />
13
14     <!-- Load jQuery -->
15     <script src="../jquery-1.9.1.min.js" type="text/javascript" ></script>
16
17     <!-- Initialize the library -->
18     <link rel="stylesheet" href="../simpleWebSlides.css" type="text/css"
19           media="all" />
20     <script src="../simpleWebSlides.js" type="text/javascript" >
21     </script>
22
23     <!-- Load a custom Theme -->
24     <link rel="stylesheet"  title="Web 2.0"
25           href="../themes/webTwoPointO.css"
26           type="text/css" />
27     <!-- Customize some templates and initialize -->
28
29     <script type="text/x-mathjax-config">
30       MathJax.Hub.Config({
31       tex2jax: {inlineMath: [["$","$"],["\\(","\\)"]]}
32       });
33     </script>
34
35     <script type="text/javascript"
36             src="https://c328740.ssl.cf1.rackcdn.com/mathjax/latest/MathJax.js?config=TeX-AMS_HTML-full">
37     </script>
38
39     <script type="text/javascript">
40 /*
41       SWS.Config['sws-slide-change'] = SWS.Effects.slideChangeVerticalSlide;
42       SWS.Config['sws-slide-change'] = SWS.Effects.slideChangeHorizontalSlide; */
43       SWS.Config['sws-slide-change'] = SWS.Effects.slideChangeFadeOutIn;
44
45
46       SWS.Config['sws-object-deactivate'] =  SWS.Effects.objectDeactivateFadeOut;
47       SWS.Config['sws-object-activate'] = SWS.Effects.objectActivateFadeIn;
48
49       //Ensures that we load SWS at the very end, after MathJax has
50       //been initialized
51       MathJax.Hub.Queue(function () {
52              SWS.Presentation.init();
53       });
54
55 // Some utility functions:
56 function set_color(o,c) {
57 var style = o.attr("style");
58 var a = style.split(";");
59 for(var i = 0; i &lt; a.length; i++){
60 if (a[i].indexOf("fill:") &gt;= 0){
61 a[i] = "fill: " + c;
62 break;
63 };
64 };
65 o.attr("style",a.join(";"));
66
67 };
68
69     </script>
70
71     <style type="text/css">
72       #css {
73       display:inline-block;
74       font-size: larger;
75       font-weight: bolder;
76       -webkit-transform: rotate(-20deg);
77       -moz-transform: rotate(-20deg);
78       }
79     </style>
80   </head>
81   <body>
82
83     <div class="sws-slide sws-cover sws-option-nofooter">
84       <div class="centerbox">
85         <h1>SimpleWebSlides</h1>
86         <h1>An <em>HTML</em><img style="height:28pt"
87              src="HTML5_Badge.svg" alt="5"/>
88           Presentation framework</h1>
89         <a href="mailto:kim@nguyen.vg">kim@nguyen.vg</a>
90       </div>
91     </div>
92
93     <!-- H1 below is hidden, used for table of content (TODO) -->
94     <h1>Introduction</h1>
95
96     <div class="sws-slide" >
97       <h1>What is it?</h1>
98       <em>SimpleWebSlides</em> is simple tool that allows
99       you to build funky presentations:
100       <ul>
101         <li class="sws-pause" >Write your presentations in (X)HTML5!</li>
102         <li class="sws-pause" >Theme to
103         your <span style='font-size:larger'>❤</span>'s content
104         with <em id="css">C S S</em>!</li>
105         <li class="sws-pause" >Create animations using Javascript &amp; jQuery!</li>
106       </ul>
107         <script type="text/javascript">
108           var zoom_title = function (canvas) {
109           var h1 = canvas.find("h1");
110           var old_size = h1.css('font-size');
111           h1.animate({"font-size":"80pt" }, 300)
112           .animate({"font-size":old_size }, 300);
113           };
114
115           SWS.Presentation.registerCallback(3, zoom_title);
116         </script>
117     </div>
118
119     <div class="sws-slide">
120       <h1>What's wrong with Beamer/L<sub>A</sub>T<sup>E</sup>X/Tikz?</h1>
121       <ul>
122         <li class="sws-pause">Does not easily support smooth
123         animations</li>
124         <li class="sws-pause">Hard to program/script </li>
125         <li class="sws-pause">Using modern fonts and UTF-8 is a nightmare</li>
126         <li class="sws-pause">Slow compilation times</li>
127         <li class="sws-pause">Difficult to integrate several media
128           (videos, vector graphics, sounds,…)
129         </li>
130       </ul>
131       <p  class="sws-pause">But wait! I'm loosing all those nicely
132       rendered mathematical formulæ!</p>
133       <p class="sws-pause"> You mean like this one<sup>*</sup> ?
134         $$
135         F_n = \frac{1}{\sqrt{5}}\cdot\left(\frac{1+\sqrt{5}}{2}\right)^n-\frac{1}{\sqrt{5}}\cdot\left(\frac{1-\sqrt{5}}{2}\right)^n
136         $$
137       </p>
138       <p class="sws-pause">or that one<sup>*</sup> ?
139
140         $$
141         \frac{\Gamma\cup\{x\mapsto t\}\vdash e : s}{\Gamma\vdash \lambda x^{t}.e : t \rightarrow s}
142         $$
143       </p>
144       <p class="sws-pause">*: All this is done
145         using <a href="http://www.mathjax.org">MathJax!</a> and
146         written like this:<br/>
147 <pre><code>
148     \frac{
149           \Gamma\cup\{x\mapsto t\}\vdash e : s
150     }{
151           \Gamma\vdash \lambda x^{t}.e : t \rightarrow s
152     }
153 </code></pre>
154 </p>
155     </div>
156     <div class="sws-slide">
157       <h1>A simple example</h1>
158       <p class="sws-onframe-1_3">
159       A minimal slide, with no animation looks like this:
160 <pre><code>
161      &lt;div <em>class="sws-slide"</em>&gt;
162           &lt;h1&gt;Slide title&lt;/h1&gt;
163              Hello world!
164      &lt;/div&gt;
165 </code></pre>
166 </p>
167 <p class="sws-pause">
168   You can also reveal things progressively like this:
169   <pre><code>
170       &lt;p&gt; Text 1&lt;/p&gt;
171       &lt;p <em>class="sws-pause"</em>&gt;
172       Text 2 (appears afterwards)
173       &lt;/p&gt;
174   </code></pre>
175 </p>
176 <p class="sws-pause">
177   You can also set an element to appear on specific frames:
178   <pre><code>
179       &lt;p&gt; Text 1&lt;/p&gt;
180       &lt;p <em>class="sws-onframe-1-5_9"</em>&gt;
181       Appears on frame 2, 3, 4, 5, 6 and 10 of the current slide
182       (frame numbering starts at 0).
183       &lt;/p&gt;
184   </code></pre>
185 </p>
186     </div>
187 <div class="sws-slide">
188   <h1>Scripting your presentation</h1>
189   <p>
190     Of course, you can script your presentation with Javascript!<br/>
191     You just need to add the <code>script</code> element somewhere in
192     the current <code>div</code>
193     <pre><code>
194 &lt;script type="text/javascript"&gt;
195     function zoom_title (canvas) {
196         var h1 = canvas.find("h1");
197         var old_size = h1.css('font-size');
198             h1.animate({"font-size":"80pt" }, 300)
199                .animate({"font-size":old_size }, 300);
200     };
201     //Call the zoom_title function on the 4th and 7th frame
202     <em>SWS.Presentation.registerCallback("3_6", zoom_title);</em>
203 &lt;script&gt;
204 </code></pre>
205     (That's not a bug, you should keep pressing next, see how many
206     steps there are on this slide)
207   </p>
208
209 <script type="text/javascript">
210   SWS.Presentation.registerCallback("4_7", zoom_title);
211 </script>
212
213 </div>
214 <div class="sws-slide">
215   <h1>SWS API</h1>
216   You can manipulate the presentation through
217   the <em><code>SWS.Presentation</code></em> object. For instance:
218   <code><pre>
219       &lt;a onclick="SWS.Presentation.previous();"&gt;◀◀◀◀◀&lt;/a&gt;
220       &lt;a onclick="SWS.Presentation.next();"&gt;▶▶▶▶▶&lt;/a&gt;
221       &lt;a onclick="SWS.Presentation.goToSlide(1,2);"&gt;Go back in time!&lt;/a&gt;
222 </pre></code>
223   Let's try it:
224   <a onclick="SWS.Presentation.previous();SWS.Presentation.refresh();">◀◀◀◀◀</a>
225   <a onclick="SWS.Presentation.next();SWS.Presentation.refresh();">▶▶▶▶▶</a>
226   <a onclick="SWS.Presentation.goToSlide(1,2);">Go
227     back in time!</a> (to the second frame of the first slide)
228 </div>
229 <div class="sws-slide">
230   <h1>Some more fancy stuff</h1>
231 Let's put some <em>inline</em> SVG:
232 <div style="text-align:center;">
233 <svg
234    xmlns:dc="http://purl.org/dc/elements/1.1/"
235    xmlns:cc="http://creativecommons.org/ns#"
236    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
237    xmlns:svg="http://www.w3.org/2000/svg"
238    xmlns="http://www.w3.org/2000/svg"
239    xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
240    xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
241    width="68.160713"
242    height="170.35268"
243    id="svg2"
244    version="1.1"
245    inkscape:version="0.48.3.1 r9886"
246    sodipodi:docname="lights.svg">
247   <defs
248      id="defs4" />
249   <sodipodi:namedview
250      id="base"
251      pagecolor="#ffffff"
252      bordercolor="#666666"
253      borderopacity="1.0"
254      inkscape:pageopacity="0.0"
255      inkscape:pageshadow="2"
256      inkscape:zoom="5.6"
257      inkscape:cx="38.9935"
258      inkscape:cy="56.441072"
259      inkscape:document-units="px"
260      inkscape:current-layer="layer1"
261      showgrid="true"
262      fit-margin-top="0"
263      fit-margin-left="0"
264      fit-margin-right="0"
265      fit-margin-bottom="0"
266      inkscape:window-width="1627"
267      inkscape:window-height="1026"
268      inkscape:window-x="1077"
269      inkscape:window-y="24"
270      inkscape:window-maximized="1">
271     <inkscape:grid
272        type="xygrid"
273        id="grid2985"
274        empspacing="5"
275        visible="true"
276        enabled="true"
277        snapvisiblegridlinesonly="true"
278        originx="-82.348214px"
279        originy="-877.32807px" />
280   </sodipodi:namedview>
281   <metadata
282      id="metadata7">
283     <rdf:RDF>
284       <cc:Work
285          rdf:about="">
286         <dc:format>image/svg+xml</dc:format>
287         <dc:type
288            rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
289         <dc:title />
290       </cc:Work>
291     </rdf:RDF>
292   </metadata>
293   <g
294      inkscape:label="Layer 1"
295      inkscape:groupmode="layer"
296      id="layer1"
297      transform="translate(-82.348214,-4.6814313)">
298     <g
299        id="g3014"
300        transform="matrix(1.5714286,0,0,1.5714286,-48.571431,-4.2069617)">
301       <rect
302          ry="10"
303          y="7.3621826"
304          x="85"
305          height="105"
306          width="40"
307          id="rect2989"
308          style="fill:#000a1a;fill-opacity:1;stroke:#1b373d;stroke-width:3.3829999;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0" />
309       <path
310          transform="translate(132.5,-20)"
311          d="m -15,44.862183 c 0,6.903559 -5.596441,12.5 -12.5,12.5 -6.903559,0 -12.5,-5.596441 -12.5,-12.5 0,-6.90356 5.596441,-12.5 12.5,-12.5 6.903559,0 12.5,5.59644 12.5,12.5 z"
312          sodipodi:ry="12.5"
313          sodipodi:rx="12.5"
314          sodipodi:cy="44.862183"
315          sodipodi:cx="-27.5"
316          id="topdisk"
317          style="fill:#000a1a;fill-opacity:1;stroke:#1b373d;stroke-width:3.3829999;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
318          sodipodi:type="arc" />
319       <path
320          d="m -15,44.862183 c 0,6.903559 -5.596441,12.5 -12.5,12.5 -6.903559,0 -12.5,-5.596441 -12.5,-12.5 0,-6.90356 5.596441,-12.5 12.5,-12.5 6.903559,0 12.5,5.59644 12.5,12.5 z"
321          sodipodi:ry="12.5"
322          sodipodi:rx="12.5"
323          sodipodi:cy="44.862183"
324          sodipodi:cx="-27.5"
325          id="middledisk"
326          style="fill:#000a1a;fill-opacity:1;stroke:#1b373d;stroke-width:3.3829999;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
327          sodipodi:type="arc"
328          transform="translate(132.5,15)" />
329       <path
330          d="m -15,44.862183 c 0,6.903559 -5.596441,12.5 -12.5,12.5 -6.903559,0 -12.5,-5.596441 -12.5,-12.5 0,-6.90356 5.596441,-12.5 12.5,-12.5 6.903559,0 12.5,5.59644 12.5,12.5 z"
331          sodipodi:ry="12.5"
332          sodipodi:rx="12.5"
333          sodipodi:cy="44.862183"
334          sodipodi:cx="-27.5"
335          id="bottomdisk"
336          style="fill:#000a1a;fill-opacity:1;stroke:#1b373d;stroke-width:3.3829999;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
337          sodipodi:type="arc"
338          transform="translate(132.5,50)" />
339     </g>
340   </g>
341 </svg>
342 </div>
343 Of course we can animate it with some javascript!
344 <script type="text/javascript">
345   SWS.Presentation.registerCallback(0, function(o){
346   set_color(o.find("#topdisk"), "#000a1a");
347   });
348   SWS.Presentation.registerCallback(1, function(o){
349   set_color(o.find("#topdisk"), "#ff0000");
350   set_color(o.find("#middledisk"), "#000a1a");
351   });
352   SWS.Presentation.registerCallback(2, function(o){
353   set_color(o.find("#middledisk"), "#ffa500");
354   set_color(o.find("#bottomdisk"), "#000a1a");
355 /**/
356   SWS.Config['sws-slide-change'] = SWS.Effects.slideChangeFadeOutIn;
357   });
358   SWS.Presentation.registerCallback(3, function(o){
359   set_color(o.find("#bottomdisk"), "#00ff00");
360   SWS.Config['sws-slide-change'] = SWS.Effects.slideChangeHorizontalSlide;
361 /* */
362   });
363 </script>
364 </div>
365 <div class="sws-slide">
366   <h1>Totally customizable</h1>
367   <p>
368     BTW did you see how I changed the transition effect for the
369     previous slide ?
370   </p>
371 </div>
372
373   </body>
374 </html>