previous   next   contents  

12. The SMIL Transition Effects Module

Editors
Eric Hyche ([email protected]), (RealNetworks)


Table of contents

12.1 Introduction

In most public descriptions of SMIL, the language is described as "allowing authors to bring TV-like content to the Web." However, one aspect of presentations commonly seen on television has been noticeably absent from SMIL: transitions such as fades and wipes. In SMIL 1.0, any representation of transitions had to be "baked into" the media itself and there was no method of coordinating transitions across multiple media regions and timelines. The purpose of this document is to specify the semantics and syntax for describing transitions within SMIL and other XML-based documents. Also, this specification describes a taxonomy of transitions based on SMPTE 258M-1993 [SMPTE] as well as a compact set of parameters which can be used to express this set of transitions. Although the majority of transitions described in this document are visual transitions, a number of transitions have audio equivalents and are equally applicable.

Any XML language that wants to make use of transitions must have:

  1. A Layout Language. Transitions operate on media elements which are associated with layout elements. If transitions are coordinated across multiple media elements, then it is necessary to be able to access properties of the layout region in which that media is playing. Therefore, any language which would use transitions must have the ability to express the concept of playback regions. CSS2 and SMIL 1.0 are examples of languages with layout language capabilities.
  2. A Timing Model. In this context, transitions are time-based, client-side effects between media. Since transitions occur over time and are applied to media at a certain point in time, then the host XML language must have ability to specify a timeline. SMIL 1.0 and HTML+TIME are examples of languages with a time model.

For example, consider a simple still image slideshow of four images, each displayed for 5 seconds. In SMIL 1.0 this might look like:

<smil>
    <head>
        <layout>
            <root-layout width="256" height="256" background-color="#000000"/>
            <region id="whole" left="32" top="32" width="192" height="192"/>
        </layout>
    </head>
    <body>
        <seq>
            <img src="butterfly.jpg" region="whole" dur="5s"/>
            <img src="eagle.jpg"     region="whole" dur="5s"/>
            <img src="wolf.jpg"      region="whole" dur="5s"/>
            <img src="seal.jpg"      region="whole" dur="5s"/>
        </seq>
    </body>
</smil>

and the corresponding presentation in HTML+TIME (for the timing model) and CSS2 (for the layout language):


<HTML>
    <HEAD>
        <XML:NAMESPACE PREFIX="t"/>
        <STYLE>
            DIV      { position:         absolute;
                       left:             0px;
                       top:              0px;
                       width:            256px;
                       height:           256px;
                       background-color: #000000 }
            .whole   { position:         absolute;
                       left:             32px;
                       top:              32px;
                       width:            192px;
                       height:           192px }
        </STYLE>

    </HEAD>
    <BODY>
        <DIV STYLE="behavior:url(#default#time);" t:TIMELINE="seq">
            <t:IMG CLASS="whole" STYLE="behavior:url(#default#time);" t:SRC="butterfly.jpg"   t:DUR="5" t:TIMEACTION="display"/>
            <t:IMG CLASS="whole" STYLE="behavior:url(#default#time);" t:SRC="eagle.jpg"       t:DUR="5" t:TIMEACTION="display"/>
            <t:IMG CLASS="whole" STYLE="behavior:url(#default#time);" t:SRC="wolf.jpg"        t:DUR="5" t:TIMEACTION="display"/>
            <t:IMG CLASS="whole" STYLE="behavior:url(#default#time);" t:SRC="seal.jpg"        t:DUR="5" t:TIMEACTION="display"/>
        </DIV>
    </BODY>
</HTML>

Currently when these presentations play, we see a straight "cut" from one image to another, as shown in this animated image. However, what we would like to see are three wipes in between the four images: in between butterfly.jpg and eagle.jpg at 5 seconds, in between eagle.jpg and wolf.jpg at 10 seconds, and in between wolf.jpg and seal.jpg at 15 seconds. Therefore, we must define the following to our presentations:

  1. The class of transition we wish to apply. For instance, if we want all three transitions to be 1-second wipes, then we can define 1-second wipes as a transition class and apply this class to the media elements. For purposes of introductory illustration, we will use several transition parameters without first defining them. However, for complete detail about transition parameters, see the Transition Taxonomy and Parameters section.
  2. The media elements to which we wish to apply this transition class. For more detail about applying transition classes to media elements, see the Applying Transitions to Media Elements section.

Adding these two definitions to the previous SMIL 1.0 slideshow example would make the presentation now look like:

<smil>
    <head>
        <layout>
            <root-layout width="256" height="256" background-color="#000000"/>
            <region id="whole" left="32" top="32" width="192" height="192"/>
        </layout>
        <transition id="wipe1" type="wipe" subtype="slideHorizontal" dur="1s"/>
    </head>
    <body>
        <seq>
            <img src="butterfly.jpg" region="whole" dur="5s"/>
            <img src="eagle.jpg"     region="whole" dur="5s" transition="wipe1"/>
            <img src="wolf.jpg"      region="whole" dur="5s" transition="wipe1"/>
            <img src="seal.jpg"      region="whole" dur="5s" transition="wipe1"/>
        </seq>
    </body>
</smil>

and the presentation in HTML+TIME and CSS2 would now look like:


<HTML>
    <HEAD>
        <XML:NAMESPACE PREFIX="t"/>
        <STYLE>
            DIV      { position:         absolute;
                       left:             0px;
                       top:              0px;
                       width:            256px;
                       height:           256px;
                       background-color: #000000 }
            .whole   { position:         absolute;
                       left:             32px;
                       top:              32px;
                       width:            192px;
                       height:           192px }
            .wipe1   { transitionType:    wipe;
                       transitionSubType: slideHorizontal;
                       transitionDur:     1s }
        </STYLE>
    </HEAD>
    <BODY>
        <DIV STYLE="behavior:url(#default#time);" t:TIMELINE="seq">
            <t:IMG CLASS="whole"       STYLE="behavior:url(#default#time);" t:SRC="butterfly.jpg"   t:DUR="5" t:TIMEACTION="display"/>
            <t:IMG CLASS="whole;wipe1" STYLE="behavior:url(#default#time);" t:SRC="eagle.jpg"       t:DUR="5" t:TIMEACTION="display"/>
            <t:IMG CLASS="whole;wipe1" STYLE="behavior:url(#default#time);" t:SRC="wolf.jpg"        t:DUR="5" t:TIMEACTION="display"/>
            <t:IMG CLASS="whole;wipe1" STYLE="behavior:url(#default#time);" t:SRC="seal.jpg"        t:DUR="5" t:TIMEACTION="display"/>
        </DIV>
    </BODY>
</HTML>

Now the presentations play as follows. First, at 0 seconds, we cut directly to butterfly.jpg. Next, at 5 seconds we begin a 1-second wipe into eagle.jpg. Therefore, at 6 seconds, eagle.jpg is fully displayed and remains displayed for 4 more seconds until 10 seconds. At this time, we begin a another 1-second wipe from eagle.jpg to wolf.jpg. At 11 seconds, wolf.jpg is fully displayed until 15 seconds, when we begin another 1-second transition to seal.jpg. At 16 seconds, seal.jpg is fully displayed until 20 seconds at which time the presentation ends. When the presentation ends, there is an immediate cut to black due to the default fill="remove" behavior of SMIL and the TIMEACTION="display" behavior of HTML+TIME. This is visually illustrated by this animated image. Notice that these transitions occur during the timeline each of the images and do not add or subtract from their host timeline. In this case, the transition occurs (by default) at the beginning of the timeline, although we will discuss later a method of placing the transition at the end of a media element's timeline.

This document is structured as follows. In the Taxonomy section, we define a taxonomy of transitions and describe the families of transitions. Next in the Parameters section, we define a set of parameters which can fully describe all the transitions in our taxonomy. Next, in the Applying Transitions to Media Elements section, we describe the semantics of applying a transition class to a media element. Next, in the Multiple-Element Transitions section, we describe how to apply single transitions across multiple media elements.

12.2 Transition Taxonomy

Using CSS, making text appear in a certain font face and size involves defining a style and then using selectors to apply that style to the appropriate elements. The entire set of possible font faces are grouped into broad font families with specialization within each family. In a similar manner, we define in this section several broad families of transitions and describe the distinguishing characteristics of each family. In the next section, we will define a parameter set which can fully specify all the transitions in each family.

In all of the examples of specific transitions mentioned in this document, we will refer to the following model: we refer to the element being transitioned from as element A (or just A) and we refer to the element being transitioned to as element B (or just B). We define the following eight families (or types) of transitions:

edgeWipe
B is "under" A and is uncovered by combinations of edges. SMPTE Wipe Codes 1-74 are members of this family. For example, in SMPTE Wipe Code 1, a vertical line moves left to right across A. B is revealed on the left side of the line, while A remains on the right side. SMPTE Wipe Code 1 is illustrated by this animated image.
irisWipe
B is "under" A and is uncovered by an expanding shape. SMPTE Wipe Codes 101-131 are members of this family. For example, in SMPTE Wipe Code 102, B is gradually revealed by an expanding diamond shape. SMPTE Wipe Code 102 is illustrated by this animated image.
radialWipe
B is "under" A and is uncovered by one or more radial sweeps. SMPTE Wipe Codes 201-264 are members of this family. For example, in SMPTE Wipe Code 201, B is revealed by a clockwise sweep, as shown in this animated image.
matrixWipe
B is "under" A and is uncovered by one or more block traversals. SMPTE Wipe Codes 301-353 are members of this family. For example, in SMPTE Wipe Code 301, B is revealed by a block which alternates moving left to right then right to left as it moves down A. This transition is illustrated by this animated image.
pushWipe
A is "pushed" out of view by B. An example of this family would be a transition where B moves in from the left, while pushing A out of view. This transition is illustrated by this animated image.
slideWipe
B "slides over" A. An example of this family would be a transition where B moves in from the left, and slides over A, as illustrated by this animated image.
fade
additive blend between A and B, A and a color, or B and a color. An example of this family would be a crossfade between A and B, as illustrated by this animated image.
warp
A or B is spatially distorted until only B remains. An example of this family would be when B zooms in on top of A, as illustrated by this animated image.

Each of these transition "types" are further divided into many "subtypes". The table below lists the possible subtypes for each type. Also the table lists the mapping between the assigned name and the SMPTE Wipe Code (where applicable).

Transition type

Transition subtypes (SMPTE Wipe Codes in parentheses)

edgeWipe "slideHorizontal" (1) [default], "slideVertical" (2), "topLeft" (3), "topRight" (4), "bottomRight" (5), "bottomLeft" (6), "fourCorner" (7), "fourBox" (8), "barnVertical" (21), "barnHorizontal" (22), "topCenter" (23), "rightCenter" (24), "bottomCenter" (25), "leftCenter" (26), "diagonalLeftDown" (41), "diagonalRightDown" (42), "verticalBowTie" (43), "horizontalBowTie" (44), "diagonalLeftOut" (45), "diagonalRightOut" (46), "diagonalCross" (47), "diagonalBox" (48), "filledVUp" (61), "filledVRight" (62), "filledVBottom" (63), "filledVLeft" (64), "hollowVUp" (65), "hollowVRight" (66), "hollowVBottom" (67), "hollowVLeft" (68), "verticalZigZag" (71), "horizontalZigZag" (72), "verticalBarnZigZag" (73), "horizontalBarnZigZag" (74)
irisWipe "rectangle" (101) [default], "diamond" (102), "triangleUp" (103), "triangleRight" (104), "triangleDown" (105), "triangleLeft" (106), "arrowheadUp" (107), "arrowheadRight" (108), "arrowheadDown" (109), "arrowheadLeft" (110), "pentagonUp" (111), "pentagonDown" (112), "hexagon" (113), "hexagonSide" (114), "cicle" (119), "oval" (120), "ovalSide" (121), "catEye" (122), "catEyeSide" (123), "roundRect" (124), "roundRectSide" (125), "star4pt" (127), "star5pt" (128), "star6pt" (129), "heart" (130), "keyhole" (131)
radialWipe "top" (201) [default], "right" (202), "bottom" (203), "left" (204), "topBottom" (205), "leftRight" (206), "quadrant" (207), "topBottom180" (211), "rightLeft180" (212), "topBottom90" (213), "rightLeft90" (214), "top180" (221), "right180" (222), "bottom180" (223), "left180" (224), "counterTopBottom" (225), "counterLeftRight" (226), "doubleTopBottom" (227), "doubleLeftRight" (228), "vOpenTop" (231), "vOpenRight" (232), "vOpenBottom" (233), "vOpenLeft" (234), "vOpenTopBottom" (235), "vOpenLeftRight" (236), "topLeft" (241), "bottomLeft" (242), "bottomRight" (243), "topRight" (244), "topLeftBottomRight" (245), "bottomLeftTopRight" (246), "topLeftRight" (251), "leftTopBottom" (252), "bottomLeftRight" (253), "rightTopBottom" (254), "doubleCenterRight" (261), "doubleCenterTop" (262), "doubleCenterTopBottom" (263), "doubleCenterLeftRight" (264)
matrixWipe "horizontal" (301) [default], "vertical" (302), "topLeftDiagonal" (303), "topRightDiagonal" (304), "bottomRightDiagonal" (305), "bottomLeftDiagonal" (306), "cwTopLeft" (310), "cwTopRight" (311), "cwBottomRight" (312), "cwBottomLeft" (313), "ccwTopLeft" (314), "ccwTopRight" (315), "ccwBottomRight" (316), "ccwBottomLeft" (317), "verticalStartTop" (320), "verticalStartBottom" (321), "verticalStartTopOpposite" (322), "verticalStartBottomOpposite" (323), "verticalStartLeft" (324), "verticalStartRight" (325), "verticalStartLeftOpposite" (326), "verticalStartRightOpposite" (327), "doubleDiagonalTopRight" (328), "doubleDiagonalBottomRight" (329), "doubleSpiralTop" (340), "doubleSpiralBottom" (341), "doubleSpiralLeft" (342), "doubleSpiralRight" (343), "quadSpiralVertical" (344), "quadSpiralHorizontal" (345), "verticalWaterfallLeft" (350), "verticalWaterfallRight" (351), "horizontalWaterfallLeft" (352), "horizontalWaterfallRight" (353)
pushWipe "fromTop", "fromRight", "fromBottom", "fromLeft" [default]
slideWipe "fromTop", "fromRight", "fromBottom", "fromLeft" [default], "angular"
fade "crossfade" [default], "fadeToColor", "fadeFromColor"
warp "explode", "implode", "zoomOver" [default], "zoomBoth"

For each of the types, the first subtype is labeled as the "default" subtype. The purpose of this is to allow for a default transition for this transition family, if either the transition subtype is not specified or not implemented. This is a similar idea to CSS's font-family property, where the value is a comma-separated list of font faces of families. If the first font in the list is not available, then the browser tries the second. Usually, the last font in the list will be very generic, so that all browsers can support it.

In the same way, authors can specify a type and subtype for a transition class. If this transition class is not available or not implemented by the user agent, then the user agent should fall back on the default subtype for that transition family. The side effect of this is that all renderers are required to support a minimum of 8 transitions (the default transition for each of the transition families).

12.3 Transition Parameters

Now that we have a taxonomy of transition types and subtypes defined, now we must define a set of parameters which can span the entire space of transitions. In the following list, not all the parameters apply to every transition type. However, there is enough commonality between parameters for each family that it is not useful to have a separate parameter set for each transition family.

We also present the <transition> element for SMIL. In SMIL, this element defines a single transition class. If the transition class is expressed in a stylesheet language such as CSS, then each of these parameters are properties defined in CSS syntax within the <STYLE> element. In order not to be distinguished from other CSS properties, the prefix "transition" should be prepended to each of the parameter names to create the CSS property name, using camelCase to mark the separation between words. For example, the transition parameter "dur" would translate directly to "dur" as a SMIL attribute but would translate to "transitionDur" as a CSS property. We will reference an Integration section here when that section is complete.

12.3.1 The <transition> element

The <transition> element defines a single transition class within a SMIL document. This element should appear in the <head> section of the document. Since there may be multiple transition classes used in a SMIL document, then there may be multiple <transition> elements in the <head> section of the SMIL document.

Element attributes

id
This attribute uniquely identifies the transition element within the SMIL document. Its value is an XML identifier.
type
This is the type or family of transition. The "type" attribute is required and must be one of the transition families listed in the Taxonomy section.
subtype
This is the subtype of the transition. This parameter is optional and if specified, must be one of the transition subtypes appropriate for the specified type as listed in the table of subtypes in the Taxonomy section. If this parameter is not specified, it defaults to the subtype listed as the default subtype for the specified transition type.
dur
This is the duration of the transition. The value of this attribute must be a clock-value as defined by the SMIL Timing and Synchronization Module. This parameter has a default of 1 second.
base
This defines whether the transition is applied to beginning or the end of the host timeline. There are two possible values for base:
begin
The transition occurs during the time [0,dur] in the host timeline. This is the default value.
end
The transition occurs during the time [D-dur,D] in the host timeline, where D is the duration of the host timeline, which may be possibly unknown at authoring time.
startPercent
This is the percentage through the transition at which to begin execution. Legal values are integers in the range [0,100]. For instance, we may want to begin a crossfade with the destination image being already 30% faded in.
The default value is zero.
endPercent
This is the percentage through the transition at which to end execution. Legal values are integers in the range [0,100] and the value of this attribute must be greater than or equal to the value of the "startPercent" attribute.
The default value is 100.
horzRepeat
This attribute specifies how many times to repeat the wipe pattern along the horizontal axis.
The default value is 0 (the pattern is not repeated horizontally).
vertRepeat
This attribute specifies how many times to repeat the wipe pattern along the vertical axis.
The default value is 0 (the pattern is not repeated vertically).
startX
This attribute specifies the distance from the left side of the element region at which to start the warp transition. This parameter is a floating point number in the range [-2.0, 2.0], where 0.0 is the center of the region, -1.0 is the left edge, and 1.0 is the right edge. Therefore, half of the width of the region is defined as a unit measure. So -2.0 is two units to the left of the center of the element region, and 2.0 is two units to the right of the center of the element region.
The default value is 0.
startY
This attribute specifies the distance from the top side of the element at which to start the warp transition. This parameter is a floating point number in the range [-2.0, 2.0], where 0.0 is the center of the region, -1.0 is the left edge, and 1.0 is the right edge. Therefore, half of the height of the region is defined as a unit measure. So -2.0 is two units above the center of the element region, and 2.0 is two units below the center of the element region.
The default value is 0.
endX
This attribute specifies the distance from the left side of the element at which to end the warp transition. This parameter is a floating point number in the range [-2.0, 2.0], where 0.0 is the center of the region, -1.0 is the left edge, and 1.0 is the right edge. Therefore, half of the width of the region is defined as a unit measure. So -2.0 is two units to the left of the center of the element region, and 2.0 is two units to the right of the center of the element region.
The default value is 0.
endY
This attribute specifies the distance from the top side of the element at which to start the warp transition. This parameter is a floating point number in the range [-2.0, 2.0], where 0.0 is the center of the element, -1.0 is the left edge, and 1.0 is the right edge. Therefore, half of the height of the region is defined as a unit measure. So -2.0 is two units above the center of the element region, and 2.0 is two units below the center of the element region.
The default value is 0.
borderWidth
This attribute specifies the width of a generated border along a wipe edge. Legal values are integers greater than or equal to 0. If borderWidth is equal to 0, then this implies no generated border along the wipe edge.
The default value is 0.
color
If the value of the "type" attribute is "wipe", "iris", "radial", "matrix", "push", "slide", or "warp", then this attribute specifies the content of the generated border along a wipe or warp edge. This attribute can either be a color (as specified by the "background-color" property of the CSS2 specification) or the string "blend". If the value of this attribute is a color, then the generated border along the wipe or warp edge is filled with this color. If the value of this attribute is "blend", then generated border along the wipe blend is an additive blend (or blur). If the value of the "type" attribute is "fade" and the value of the "subtype" attribute is "fadeToColor" or "fadeFromColor", then this color specifies the starting or ending color of the fade.
The default value is "black".

Element content

The <transition> element is an empty element.

Examples of the <transition> element.

For example, suppose we wanted to define two transition classes: a simple 2-second fade-to-black and a 5-second keyhole-shaped iris wipe. In SMIL, our definition would look like:


    ...
    <head>
        ...
        <transition id="ftb2" type="fade"     subtype="fadeToColor"
                       dur="2s" color="#000000" />
        <transition id="key5" type="irisWipe" subtype="keyhole"
                       dur="5s" />
        ...                      
    </head>
    ...

and in a CSS-like syntax our definition would look like:

   ...
    <HEAD>
        ...
        <STYLE>
            .ftb2 { transitionType:    fade;
                    transitionSubtype: fadeToColor;
                    transitionDur:     2s;
                    transitionColor:   #000000 }
            .key5 { transitionType:    irisWipe;
                    transitionSubtype: keyhole;
                    transitionDur:     5s }
        </STYLE>
        ...                      
    </HEAD>
    ...

Note that in SMIL, the "id" attribute is necessary to identify the transition class. In CSS, the transition class name is implicit in the CSS class selector notation and thus an "id" property is unnecessary.

12.3.2 Handling Parameter Errors

Transitions parameters can be specified incorrectly in many different ways with varying levels of severity. Therefore, the following errors should be handled with the specified action:

  1. Transitions subtype is not valid for specified transition type. The specified transition subtype should be ignored and the default subtype for the specified transition type should be performed.
  2. Transition duration is not specified. The default duration of 1 second should be assumed.
  3. Transition parameter is outside the legal range. If a transition parameter is specified outside of the legal range, then the default value of the parameter should be assumed. For instance, the startX parameter has a legal range of [-2.0,2.0] and a default value of 0.0. If startX were to be specified as 3.0, then the specified value should be ignored and a default value of 0.0 should be assumed.
  4. Transition parameter does not apply to this transition type. Since not all transition parameters apply to all transition types, then a common error could be to specify a transition parameter which does not apply to the specified transition type. These irrelevant parameters should be ignored. For instance, the "startX" parameter only applies to the "warp" transition type. If "startX" were to be specified for the "edgeWipe" transition type, then it should be ignored.
  5. Transition duration is longer than the duration of the media object itself. In this case, the entire transition should be ignored and not performed.
  6. Two transitions are specified as active on the same region at the same time. For example, image B follows image A in a region and A has an base="end" transition and B has a base="begin" transition. In conflicts involving a begin versus an end transition, the begin transition is used and the end transition is ignored.

12.4 Applying Transitions to Media Elements

Once a transition class has been defined in the head of a document, then a transition instance can be created by applying the transition class to the timeline of a media object element. For languages which support CSS style, the class selector is used to apply a transition class to a media element. The value of the class attribute is defined in the class selector of the transition definition. For SMIL, a "transition" attribute is added to all media object elements.

12.4.1 The "transition" attribute.

The "transition" attribute is added to all media object elements. The default value of the transition attribute is an empty string, which indicates that no transition should be performed. The value of the "transition" attribute should be the same as the value of the "id" attribute of one of the <transition> elements defined in the <head> of the document. If the value of the "transition" attribute does not correspond to the value of the "id" attribute of any one of the <transition> elements in the <head> of the document, then this is an error. In this case, the value of the "transition" attribute should be considered to be the empty string and therefore no transition should be performed.

In SMIL, this attribute may be applied to any media object element. These elements are listed in the SMIL Media Object Module. In other languages, this attribute may be applied to the appropriate elements which reference media objects. Also this element may be applied to other non-media elements for which transitions are desired (such as the <DIV> element in HTML.

Examples of applying the "transition" attribute.

Consider the slideshow example in the Introduction of the document with two additions: a fade-from-black is applied to butterfly.jpg and a fade-to-black is applied to seal.jpg. In SMIL this would look like:

<smil>
    <head>
        <layout>
            <root-layout width="256" height="256" background-color="#000000"/>
            <region id="whole" left="32" top="32" width="192" height="192"/>
        </layout>
        <transition id="xfade1s"    type="fade" subtype="crossfade"     dur="1s"/>
        <transition id="fromblack1" type="fade" subtype="fadeFromColor" dur="1s"/>
        <transition id="toblack1"   type="fade" subtype="fadeToColor"   dur="1s" base="end" />
    </head>
    <body>
       <seq>
            <img src="butterfly.jpg" region="whole" dur="5s" transition="fromblack1"/>
            <img src="eagle.jpg"     region="whole" dur="5s" transition="xfade1s"/>
            <img src="wolf.jpg"      region="whole" dur="5s" transition="xfade1s"/>
            <img src="seal.jpg"      region="whole" dur="5s" transition="xfade1s,toblack1"/>
       </seq>
    </body>
</smil>

and

<HTML>
    <HEAD>
        <XML:NAMESPACE PREFIX="t"/>
        <STYLE>
            DIV      { position:         absolute;
                       left:             0px;
                       top:              0px;
                       width:            256px;
                       height:           256px;
                       background-color: #000000 }
            .whole   { position:         absolute;
                       left:             32px;
                       top:              32px;
                       width:            192px;
                       height:           192px }
            .xfade1s { transitionType:    fade;
                       transitionSubType: crossfade;
                       transitionDur:     1s }
            .fromblack1 { transitionType:    fade;
                          transitionSubType: fadeFromColor;
                          transitionDur:     1s;
                          transitionColor:   #000000 }
            .toblack1 { transitionType:    fade;
                        transitionSubType: fadeToColor;
                        transitionDur:     1s;
                        transitionColor:   #000000;
                        transitionBase:    end }
        </STYLE>
    </HEAD>
    <BODY>
        <DIV STYLE="behavior:url(#default#time);" t:TIMELINE="seq">
            <t:IMG CLASS="whole,fromblack1"       STYLE="behavior:url(#default#time);" t:SRC="butterfly.jpg"   t:DUR="5" t:TIMEACTION="display"/>
            <t:IMG CLASS="whole,xfade1s"          STYLE="behavior:url(#default#time);" t:SRC="eagle.jpg"       t:DUR="5" t:TIMEACTION="display"/>
            <t:IMG CLASS="whole,xfade1s"          STYLE="behavior:url(#default#time);" t:SRC="wolf.jpg"        t:DUR="5" t:TIMEACTION="display"/>
            <t:IMG CLASS="whole,xfade1s,toblack1" STYLE="behavior:url(#default#time);" t:SRC="seal.jpg"        t:DUR="5" t:TIMEACTION="display"/>
        </DIV>
    </BODY>
</HTML>

We will use this example to illustrate the following rules for applying transitions to media elements:

  1. Since the purpose of transitions is "transitioning" from one media object to another, then transitions must be applied to either the beginning or end (or both) of some media object. However, the visual effect may appear to be applying this transition in the middle of an element's timeline. Consider the following SMIL snippet:
        ...
        <par>
            <img src="butterfly.jpg" dur="10s" region="foo"/>
            <img src="eagle.jpg" begin="3s" dur="4s" region="bar" />
        </par>
        ...
    
    

    Assuming that region "bar" is z-ordered on top of region "foo", then transitions applied to both the beginning and end of eagle.jpg would have the visual appearance of being applied during the timeline of butterfly.jpg. However, from the authoring perspective, they are still applied at the beginning and end of eagle.jpg.

  2. Applying a transition to the beginning or end of an element's timeline does not affect the duration of the element. For instance, in the example above, applying a 1-second transition at the beginning of eagle.jpg does not add or subtract from the timeline of eagle.jpg - it is still displayed from 5-10 seconds in the presentation. Applying a 1-second transition at the beginning of eagle.jpg makes the transition take place from [5,6] seconds and applying a 2-second transition at the end of eagle.jpg would make the transition happen from [8,10] seconds.
  3. Transitions which occur at the end of a media object's timeline must respect the object's fill behavior. In other words, a transition intended for the end of a media object's timeline actually take place at the effective end of that element's timeline. For instance, in the following presentation:
    
        ...
        <transition id="toblack1s" type="fade" subType="fadeToColor"
                       color="#000000" base="end" dur="1s"/>
        ...
        <par>
            <img   ... dur="10s" transition="toblack1s" fill="freeze"/>
            <video ... dur="30s" transition="toblack1s"/>
        </par>
    
    

    the effective end of the <img> element is 30s. Therefore both elements fade to black together at 29s. However, in the following:

    
        ...
    
        <transition id="toblack1s"   type="fade" subType="fadeToColor"
                       color="#000000" base="end" dur="1s"/>
        ...
        <par>
            <img   ... dur="10s" transition="toblack1s" fill="remove"/>
            <video ... dur="30s" transition="toblack1s"/>
        </par>
    
    

    the effective end of the <img> element is 10s. Therefore, in this case the <img> element fades to black starting at 9s and the <video> element fades to black starting at 29s.

  4. The timeline for the media element we are transitioning to must either overlap or immediately follow the timeline for the media element we are transitioning from. In the slideshow example, the timelines for each media object we are transitioning to immediately follow the end of the timeline of the objects we are transitioning from. In these cases (where the timelines immediately follow but do not overlap), the transition is effectively between the frozen last frame of the previous ("from") media and active frames of the current ("to") media. In cases where the timelines overlap (and hence the regions being played to have different z-orders), the transition is between active frames of both media. For instance, in this transition:
    
        ...
        <seq>
            <video src="foo1.mpg" region=<reg1> ... />
            <video src="foo2.mpg" region=<reg1> transition="xfade1s" ... />
        </seq>
        ...
    
    

    the timelines do not overlap and therefore we are doing a crossfade between the last frame of foo1.mpg and active frames of foo2.mpg. In the following presentation, however:

        ...
        <transition id="xfadebeg" type="fade" subtype="crossfade" dur="1s" />
        <transition id="xfadeend" type="fade" subtype="crossfade" dur="1s" base="end" />
        ...
        <par>
            <video src="foo1.mpg" dur="30s" region="reg1" />
            <video src="foo2.mpg" begin="10s" dur="10s" region="reg2" transition="xfadebeg,xfadeend" />
        </par>
        ...
    
    

    crossfades both at the beginning and end of foo2.mpg are between active frames of both foo1.mpg and foo2.mpg.

  5. If the timelines for the media objects involved in the transition do not overlap, then the background color for the missing regions should be used. For example,
        ...
        <transition id="awipe" type="wipe" dur="1s" ... />
        ...
        <par>
            <img src="img1.jpg" region="whole" dur="2s" transition="awipe" base="end"/>
            <img src="img2.jpg" region="whole" begin="5s" dur="2s"/>
        </par>
        ...
    
    

    In this example, the timelines for img1.jpg and img2.jpg do not overlap. Therefore, img1.jpg will transition to the background color of the region.

  6. The fill behavior of an element instructs the user agent when it can remove the media object. For instance, in the following example not using transitions,
        ...
        <seq>
            <img src="img1.jpg" region="whole" dur="10s" />
            <img src="img2.jpg" region="whole" dur="10s" />
        </par>
        ...
    
    

    the implementation knows that it can remove the object representing img1.jpg after 10 seconds. However, if we were using a transition between img1.jpg and img2.jpg, then we need the object for img1.jpg to remain until after the transition is completed and then it may be removed. This is a new kind of fill behavior and is specified by a new value for the fill attribute called "transition". In the above example,

        ...
        <seq>
            <img src="img1.jpg" region="whole" dur="10s" fill="transition" transition="awipe"/>
            <img src="img2.jpg" region="whole" dur="10s" />
        </par>
        ...
    
    

    the implementation is instructed to keep the object for img1.jpg around long enough to complete the transition between img1.jpg and img2.jpg in the region named "whole".

12.5 Multi-Element Transitions

Up until this point in the discussion, we have applied transitions to single media object elements. However, it is common practice to apply transitions across several different media at once. Consider the following example:


<smil>
    <head>
        <layout>
            <root-layout width="320" height="240" background-color="#000000"/>
            <region id="whole"     left="0"   top="0"  width="320" height="240" z-index="0"/>
            <region id="leftpane"  left="16"  top="16" width="136" height="208" z-index="1"/>
            <region id="rightpane" left="168" top="16" width="136" height="208" z-index="1"/>
        </layout>
    </head>
    <body>
        <seq>
            <par>
                <img src="back1.jpg"  dur="10s" region="whole"/>
                <img src="left1.jpg"  dur="10s" region="leftpane"/>
                <img src="right1.jpg" dur="10s" region="rightpane"/>
            </par>
            <par>
                <img src="back2.jpg"  dur="10s" region="whole"/>
                <img src="left2.jpg"  dur="10s" region="leftpane"/>
                <img src="right2.jpg" dur="10s" region="rightpane"/>
            </par>
        </seq>
    </body>
</smil>

where the regions of this presentation look like:

image of four regions

Suppose that we had defined a transition class called "diagwipe" to be a 1-second diagonal wipe from upper right to lower left. In this example, we consider 4 possible different cases of how we might want to apply this transition to this presentation:

Case 1 Case 2

Case 1

Case 2

Case 3 Case 4

Case 3

Case 4

Cases 1 and 4 are fairly straightforward, since they are applying individual transitions to individual media elements, which we discussed in the previous section. The SMIL for Case 1 would look like:


<smil>
    <head>
        <layout>
            <root-layout width="320" height="240" background-color="#000000"/>
            <region id="whole"     left="0"   top="0"  width="320" height="240" z-index="0"/>
            <region id="leftpane"  left="16"  top="16" width="136" height="208" z-index="1"/>
            <region id="rightpane" left="168" top="16" width="136" height="208" z-index="1"/>
        </layout>
        <transition id="diagwipe" type="wipe" subtype="diagonalRightDown" dur="1s"/>
    </head>
    <body>
        <seq>
            <par>
                <img src="back1.jpg"  dur="10s" region="whole"/>
                <img src="left1.jpg"  dur="10s" region="leftpane"/>
                <img src="right1.jpg" dur="10s" region="rightpane"/>
            </par>
            <par>
                <img src="back2.jpg"  dur="10s" region="whole"/>
                <img src="left2.jpg"  dur="10s" region="leftpane"  transition="diagwipe"/>
                <img src="right2.jpg" dur="10s" region="rightpane" transition="diagwipe"/>
            </par>
        </seq>
    </body>
</smil>

and the SMIL for Case 4 would look like:

<smil>
    <head>
        <layout>
            <root-layout width="320" height="240" background-color="#000000"/>
            <region id="whole"     left="0"   top="0"  width="320" height="240" z-index="0"/>
            <region id="leftpane"  left="16"  top="16" width="136" height="208" z-index="1"/>
            <region id="rightpane" left="168" top="16" width="136" height="208" z-index="1"/>
        </layout>
        <transition id="diagwipe" type="wipe" subtype="diagonalRightDown" dur="1s"/>
    </head>
    <body>
        <seq>
            <par>
                <img src="back1.jpg"  dur="10s" region="whole"/>
                <img src="left1.jpg"  dur="10s" region="leftpane"/>
                <img src="right1.jpg" dur="10s" region="rightpane"/>
            </par>
            <par>
                <img src="back2.jpg"  dur="10s" region="whole" transition="diagwipe"/>
                <img src="left2.jpg"  dur="10s" region="leftpane"/>
                <img src="right2.jpg" dur="10s" region="rightpane"/>
            </par>
        </seq>
    </body>
</smil>

In Cases 2 and 3, however, we want to apply the transition to the "whole" region and either have the "leftpane" and "rightpane" regions clip (Case 3) or not clip (Case 2) the transition. In order to express Cases 2 and 3, there are three additional syntactical concepts which need to be added to SMIL:

  1. Parent regions. How do we do this in CSS? As defined in the Layout Module, the <region> element may be a structural child of another <region> element, as in the following SMIL fragment:
    
        <region id="parent" ... >
            <region id="child1" ... />
            <region id="child2" ... />
            ...
        </region>
    
    
  2. Allow child regions to clip their parent. How do we do this in CSS? In SMIL, we will accomplish this by allowing adding a "childrenClip" attribute to the <region> element. If childrenClip="true", then operations on the parent region (such as transitions) will be clipped by the child regions. By default, childrenClip would be "false".
  3. Lightweight media object element. We introduce a new media object element called <brush>. This element can be used to place lightweight media such as solid fills or pattern fills in regions at points along the timeline. For our purposes, we will use it to place transitions on the timeline for transitions which include multiple media elements.

The reason for introducing parent regions and a lightweight media object element is to maintain consistency with single-media-element transitions. In single-media-element transitions, we associate a transition with a media object element which in turn is associated with a playback region. This, by inference, makes a one-to-one mapping between transition and playback region. Therefore, in order to have transitions which incorporate multiple media objects (and thus multiple regions), we associate a transition with a lightweight media object which is then associated with a parent region.

A secondary purpose of the parent region is to define the bounding rectangle for transitions which will involve multiple media objects. An alternative would be to assume that the bounding rectangle is defined by the convex hull (the minimum bounding rectangle) of the set of all the regions involved. However, formally defining a parent region is simpler and more flexible.

12.5.1 The <brush> element

The <brush> element is a lightweight media object element, meaning that the media object is completely procedural. Since this media object is procedural, then all the information about the media object is specified in the attributes of the element itself. Therefore does not have to specify a "src" attribute.

Element attributes

color
The use and definition of this attribute are identical to the "background-color" property in the CSS2 specification, except that the <brush> element does not require support for "system colors".
transition
This attribute is the same as the transition attribute which was added to all media object elements and defined previously.

The <brush> element also supports all timing and synchronization attributes which all other media objects support (see the SMIL Timing and Synchronization Module and the SMIL Media Object Module for a list of these attributes).

Element content

The <brush> element is an empty element.

Now, armed with these new syntactical constructs, we can express Cases 2 and 3 in SMIL. First, Case 2:


<smil>
    <head>
        <layout>
            <root-layout width="320" height="240" background-color="#000000"/>
            <region id="whole" left="0" top="0" width="320" height="240" z-index="0">
                <region id="leftpane"  left="16"  top="16" width="136" height="208" z-index="1"/>
                <region id="rightpane" left="168" top="16" width="136" height="208" z-index="1"/>
            </region>
        </layout>
        <transition id="diagwipe" type="wipe" subtype="diagonalRightDown" dur="1s"/>
    </head>
    <body>
        <seq>
            <par>
                <img src="back1.jpg"  dur="10s" region="whole"/>
                <img src="left1.jpg"  dur="10s" region="leftpane"/>
                <img src="right1.jpg" dur="10s" region="rightpane"/>
            </par>
            <par>
                <brush                 dur="10s" region="whole" transition="diagwipe"/>
                <img  src="back2.jpg"  dur="10s" region="whole"/>
                <img  src="left2.jpg"  dur="10s" region="leftpane"/>
                <img  src="right2.jpg" dur="10s" region="rightpane"/>
            </par>
        </seq>
    </body>
</smil>

Note the following changes from other cases. First, we have made the "leftpane" and "rightpane" regions to be children of the "whole" region. Second, we have placed the <brush> element on the timeline and associated the transition with it. Now, Case 3 is a trivial change from Case 2:

<smil>
    <head>
        <layout>
            <root-layout width="320" height="240" background-color="#000000"/>
            <region id="whole" left="0" top="0" width="320" height="240" z-index="0" childrenClip="true">
            <region id="leftpane"  left="16"  top="16" width="136" height="208" z-index="1"/>
            <region id="rightpane" left="168" top="16" width="136" height="208" z-index="1"/>
            </region>
        </layout>
        <transition id="diagwipe" type="wipe" subtype="diagonalRightDown" dur="1s"/>
    </head>
    <body>
        <seq>
            <par>
                <img src="back1.jpg"  dur="10s" region="whole"/>
                <img src="left1.jpg"  dur="10s" region="leftpane"/>
                <img src="right1.jpg" dur="10s" region="rightpane"/>
            </par>
            <par>
                <brush                 dur="10s" region="whole" transition="diagwipe"/>
                <img  src="back2.jpg"  dur="10s" region="whole"/>
                <img  src="left2.jpg"  dur="10s" region="leftpane"/>
                <img  src="right2.jpg" dur="10s" region="rightpane"/>
            </par>
        </seq>
    </body>
</smil>

where all we have done is added childrenClip="true" to the declaration of the parent "whole" region.

12.6 Appendix A: Open Issues

  1. Transitions vs. Effects - should we also be able to specify non-time-based effects? These are not transitions between two different media types, but do fit nicely into the idea of style. In other words, an "emboss" effect might just be a style on a particular element. It doesn't have a duration, but it could have a start.
  2. How do we make the set of transitions and transition parameters extensible?
  3. Is is possible to come up with a language for describing what a transition is, rather than just enumerating a list of types?
  4. Not all transition parameters apply to all transition subtypes - how to we enforce this?
  5. Some transitions (like fading to a color) really only make sense at the end of a timeline. How do we enforce this?
  6. How do we express the notion of parent regions in CSS?
  7. Implementing all of the transitions in this document is a daunting task. Do we need to define some "baseline" transition subset which would be required for compliance?
  8. Do the child regions have to be completely geometrically contained by the parent? If they do not have to be, then what is the behavior of the transition across the regions (or partial regions) which are structural children but not geometric children?
  9. We implicitly assume that the lightweight media object will be placed by the author at the appropriate place in the timeline. What happens if the timeline of the lightweight media object doesn't sync with a timeline of any media objects?

previous   next   contents