How Do transIn and transOut Work in SMIL Transitions?

In Synchronized Multimedia Integration Language (SMIL), the transIn and transOut attributes define visual transition effects when media elements enter and exit a presentation. These attributes reference pre-configured transition elements, enabling precise control over how text, video, or image assets fade, wipe, dissolve, or slide on and off the screen without altering the core media files.

Understanding the Role of transIn and transOut

SMIL separates the definition of a transition effect from its application to an asset. The transIn and transOut attributes act as connectors on individual media objects—such as <img/>, <video/>, or <text/>—linking them directly to transition rules defined elsewhere in the document.

Defining Transitions with the <transition> Element

Before applying transitions using transIn or transOut, the specific effect must be declared within the <head> section inside a <layout> or <transitionFilter> block using the <transition> element. Each definition requires an xml:id or id attribute, along with visual parameters:

Example Transition Definition

<smil xmlns="http://www.w3.org/ns/SMIL">
  <head>
    <layout>
      <root-layout width="800" height="600" />
      <region id="main_region" width="800" height="600" />
    </layout>
    <transition id="fadeIn" type="fade" subtype="crossfade" dur="1s" />
    <transition id="wipeRight" type="barWipe" subtype="leftToRight" dur="1.5s" />
  </head>
  <body>
    <!-- Media elements placed here -->
  </body>
</smil>

Applying transIn and transOut in the Document Body

Once defined, the transition IDs are assigned directly to the transIn and transOut attributes on media elements located within the <body> of the SMIL document.

<body>
  <seq>
    <img src="intro.jpg" 
         region="main_region" 
         dur="5s" 
         transIn="fadeIn" 
         transOut="wipeRight" />
    <video src="presentation.mp4" 
           region="main_region" 
           dur="30s" 
           transIn="wipeRight" />
  </seq>
</body>

In this sequence, intro.jpg appears with a 1-second crossfade into the frame, remains static for its display duration, and exits via a 1.5-second bar wipe to the right. As the image exits, the subsequent video begins using the same wipe transition as its entrance effect.

Timing and Execution Behavior

SMIL enforces strict timing rules regarding how transitions interact with media duration: