Animation

From A-SMIL.org
Revision as of 08:30, 28 October 2010 by SMIL T.A. (Talk | contribs)

Jump to: navigation, search

SMIL provides the ability to change a given attribute of a media object over time. This allows one to achieve the effect of a crawl across the bottom of the screen by animating the "left" attribute of an image item, or a scrolling-up message by animating the "top" attribute.

Animations are only available on players that support positioning of media items. Some full-screen players will not support this feature. When using crawls, experiment with the hardware capability you have to determine the optimal size and shape of the animated object.

An example of a ticker crawling across the top of a region can be achieved by the following SMIL segment.

  <seq repeatCount="indefinite">
    <img src="ticker-segmentAB.png" dur="16s" region="crawl" left="0" top="0" width="2560">
      <animate attributeName="left" from="0" to="-1280" begin="0s" dur="16s" fill="freeze" />
    </img>
    <img src="ticker-segmentBC.png" dur="16s" region="crawl" left="0" top="0" width="2560">
      <animate attributeName="left" from="0" to="-1280" begin="16s" dur="16s" fill="freeze" />
    </img>
    <img src="ticker-segmentCA.png" dur="16s" region="crawl" left="0" top="0" width="2560">
      <animate attributeName="left" from="0" to="-1280" begin="32s" dur="16s" fill="freeze" />
    </img>
  </seq>

The example assumes screen width is 1280px and we use a pre-rendered graphics of 2560px in width to ensure the width of the screen is always filled during the animation.

The speed of the crawl can be adjusted by the "dur" parameter of the animate element. In this example, the "left" edge of the image changes from 0 to -1280 (1280 pixels to the left of the display region) to crawl the image (assumed to be 1280 pixels in width) out of the screen.

By concatenating several overlapping crawling segments together, the user can achieve the effect of a continuous text ticker.

Related