A declarative approach for HTML Timing using SMIL Timesheets
SMIL Timing can also be seen as a simple but highly extensible slideshow engine:
A <seq>
time container is a good basis for a
slideshow engine:
<seq>
time
container
first|prev|next|last
attributes provide a navigation
menu "out of the box"
<html> <head> […] </head> <body smil:timeContainer="seq" smil:first = "first.click" smil:prev = "prev.click" smil:next = "next.click" smil:last = "last.click"> <div id="slide1"> […] </div> <div id="slide2"> […] </div> <div id="slide3"> […] </div> <div id="slide4"> […] </div> […] <div id="slideN"> […] </div> <p smil:timeAction="none"> <button id="first"> « </button> <button id="prev"> < prev </button> <button id="next"> next > </button> <button id="last"> » </button> </p> </body> </html>
The next slide will appear in 10s or if you click on the "Next" button below — whatever comes first.
<div id="slide03" smil:timeContainer="par" smil:dur="20s"> <h2> Progressive Display with <par> </h2> <ul smil:timeContainer="par"> <li smil:begin="0:02"> On this slide </li> <li smil:begin="0:04"> the list items </li> <li smil:begin="0:06"> appear one after another </li> <li smil:begin="0:08"> at 2s intervals. </li> </ul> <p smil:begin="0:10"> The next slide will appear in 10s or if you click on the "Next" button below — whatever comes first. </p> </div>
(you still have to click the "next" button to get the next slide)
<div id="slide05" smil:timeContainer="par"> <h2> Incremental Display with <seq> </h2> <ul smil:timeContainer="seq" smil:next="slide05.click"> <li smil:fill="hold"> Click on this slide </li> <li smil:fill="hold"> and the list items </li> <li smil:fill="hold"> will appear </li> <li smil:fill="hold"> one after another. </li> </ul> <p smil:begin="0:10"> (you still have to click the "next" button to get the next slide) </p> </div>
<div id="slide07" smil:timeContainer="par"> <h2> Outlines with event-values </h2> <ul smil:timeContainer="par" smil:timeAction="class:active" class="outline"> <li smil:begin="mouseover" smil:begin="mouseout"> hover me <ul> <li> this item is collapsed by default </li> <li> this item is expanded when active </li> </ul> </li> <li smil:begin="click" smil:end="click"> click me <ul> […] </ul> </li> <li smil:begin="click" smil:end="click"> click me <ul class="expand"> <li> this item is expanded by default </li> <li> this item is collapsed when active </li> </ul> </li> </ul> </div>
/* outline -- collapsed by default */ #slideshow .outline li ul { display: none; } #slideshow .outline li.active ul { display: block; }
/* outline -- expanded by default */ #slideshow .outline li ul.expand { display: block; } #slideshow .outline li.active ul.expand { display: none; }
A slideshow alone doesn’t bring much information, but it can get much more useful when the speaker’s voice is sync’ed!
CSS transition: | | | | |
The markup is described in the slideshow itself. Nothing really new here
(except for the <par>
containers, which are described
in the timeContainer page): the main
trick is to nest several time containers to be able to animate
the content of a few slides.
The SMIL Timing spec includes a notice about hyperlink
implication on SEQ and EXCL time containers. This allows us to use
anchors to activate a particular time node in a
<seq|excl>
container:
This can be used as well on a full URL and/or with continuous media (audio/video), e.g. for our “Audio Annotations” example:
Section #1 | Section #2 | Section #3 | Section #4 | Section #5 | Section #6
Our timesheet scheduler relies on the hashchange
event to
activate the requested time node. Again, no particular JavaScript code is
applied to these links above (no onclick
or whatsoever).