Version 5, last updated by Thinker Li at January 30, 2011 16:03 UTC

Madbutterfly use standard SVG tiny 1.2 as the resource definition file. The only extension is the 'scenes' tag in the metadata. A MBSVG file contains the following structure.

 

<svg  xmlns:ns0="http://madbutterfly.sourceforge.net/DTD/madbutterfly.dtd">

    <metadata>

        <ns0:scenes>

                <scene start="1" ref="Layer1s1111">

                <scene start="1" end="3 ref="Layer2s1112">

        </ns0:scenes>

    </metadata>

    <g inkscape:groupmode="layer" inkscape:label="Layer1">

        <g inkscape:groupmode="layer" scene_group="true" id="Layer1s1111">

         content of scene 1 in layer1

        </g>

    </g>

    <g inkscape:groupmode="layer" inkscape:label="Layer2">

        <g inkscape:groupmode="layer" scene_group="true"  id="Layer2s1112">

         content of scene 1-3 in layer2

        </g>

    </g>

</svg>

 

The scenes contains a couple of scene tag. Each scene define a set of content which will be displayed in several frames. The MadButterfly runtime engine will use the information defined in this section to control the visibility of the groups defined above.

 

If we put objects outside the scene groups, it will be visible in all frames. We can use them to define the background of the design.

 

Components

A component is a SVG group with one or more independent timelines.  It is referenced in scenes with svg:use node.  We can think layers that is a child of root node are for main component. Every component, except main component, has an associated component group that is a child of the top group "components".  Children of a component group are layers of the component.  Layers of a component are organized like what layers of main component are.

<svg:svg>

<svg:g id='components'>

  <svg:g inkscape:label="component_1" component_group="true">

    <svg:g inkscape:label="layers">

      <svg:g inkscape:groupmode="layer" inkscape:label="Layer1">

        <svg:g inkscape:groupmode="layer" scene_group="true" inkscape:label="scene1"> ... </svg:g>

      </svg:g>

    </svg:g>

  </svg:g>

  <svg:g id="component_2">

  </svg:g>

</svg:g>

</svg:svg>

Every component has one or more timelines, they are stored as scene nodes like what scene nodes of main component are.

<svg  xmlns:ns0="http://madbutterfly.sourceforge.net/DTD/madbutterfly.dtd">

    <metadata>

        <ns0:components>

            <ns0:component name="Component 1" ref="component_1">

                <ns0:scenes name="default">

                    <scene start="1" ref="Layer1s1111"/>

                    <scene start="1" end="3 ref="Layer2s1112"/>

                </ns0:scenes>

            </ns0:component>

            <ns0:component ref="component_2">......</ns0:component>

        </ns0:components>

        </ns0:metadata>

    </metadata>

</svg>