<svg width="100%" height="100%" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>SVG Animation</title>
<defs>
<!-- First we need to declare the frames we use, as we cannot expect our browser to be able to load the objects from an external file during runtime.
So we <use> the frames we create in the inkscape file and give them the same id as in the Inkscape file, just so we can easily read our code and know
what frame is used frrom the Inkscape file
That way we have a clear relation to what's in the code and what is in the Inkscape file
-->
<use id="frame1" class="Button1" xlink:href="frame_anim.svg#frame1" />
<use id="frame2" class="Button1" xlink:href="frame_anim.svg#frame2" />
<use id="frame3" class="Button1" xlink:href="frame_anim.svg#frame3" />
<use id="frame4" class="Button1" xlink:href="frame_anim.svg#frame4" />
<use id="frame5" class="Button1" xlink:href="frame_anim.svg#frame5" />
<use id="frame6" class="Button1" xlink:href="frame_anim.svg#frame6" />
<use id="frame7" class="Button1" xlink:href="frame_anim.svg#frame7" />
</defs>
<g display="none">
<!-- Here we use the frames we declared in the <defs>
and make them display at the end of the previous event, for a certain time (dur="0.1s")
in this case I declared 16 frames for a total of 1.6 seconds
-->
<use xlink:href="#frame1" display="none">
<set id="f1" attributeName="display" attributeType="xml" to="inline" begin="fs1.begin" dur="0.1s" />
</use>
<use xlink:href="#frame2" display="none">
<set id="f2" attributeName="display" attributeType="xml" to="inline" begin="f1.end" dur="0.1s" />
</use>
<use xlink:href="#frame3" display="none">
<set id="f3" attributeName="display" attributeType="xml" to="inline" begin="f2.end" dur="0.1s" />
</use>
<use xlink:href="#frame4" display="none">
<set id="f4" attributeName="display" attributeType="xml" to="inline" begin="f3.end" dur="0.1s" />
</use>
<use xlink:href="#frame5" display="none">
<set id="f5" attributeName="display" attributeType="xml" to="inline" begin="f4.end" dur="0.1s" />
</use>
<use xlink:href="#frame6" display="none">
<set id="f6" attributeName="display" attributeType="xml" to="inline" begin="f5.end" dur="0.1s" />
</use>
<use xlink:href="#frame7" display="none">
<set id="f7" attributeName="display" attributeType="xml" to="inline" begin="f6.end" dur="0.1s" />
</use>
<use xlink:href="#frame6" display="none">
<set id="f8" attributeName="display" attributeType="xml" to="inline" begin="f7.end" dur="0.1s" />
</use>
<use xlink:href="#frame5" display="none">
<set id="f9" attributeName="display" attributeType="xml" to="inline" begin="f8.end" dur="0.1s" />
</use>
<use xlink:href="#frame4" display="none">
<set id="f10" attributeName="display" attributeType="xml" to="inline" begin="f9.end" dur="0.1s" />
</use>
<use xlink:href="#frame3" display="none">
<set id="f11" attributeName="display" attributeType="xml" to="inline" begin="f10.end" dur="0.1s" />
</use>
<use xlink:href="#frame2" display="none">
<set id="f12" attributeName="display" attributeType="xml" to="inline" begin="f11.end" dur="0.1s" />
</use>
<use xlink:href="#frame1" display="none">
<set id="f13" attributeName="display" attributeType="xml" to="inline" begin="f12.end" dur="0.1s" />
</use>
<use xlink:href="#frame2" display="none">
<set id="f14" attributeName="display" attributeType="xml" to="inline" begin="f13.end" dur="0.1s" />
</use>
<use xlink:href="#frame3" display="none">
<set id="f15" attributeName="display" attributeType="xml" to="inline" begin="f14.end" dur="0.1s" />
</use>
<use xlink:href="#frame2" display="none">
<set id="f16" attributeName="display" attributeType="xml" to="inline" begin="f15.end" dur="0.1s" />
</use>
<!-- This is the piece of code to repeat the whole sequence in the scene
we create an event with the id "fs1" and set the display to "inline"
our whole sequence has 16 frames of 0.1 seconds lenght
as we tell "fs1" to begin when "fs2" ends in the second iteration, we have to start our second "fs1" at "-1.6s" or it will take "1.6" seconds before our animation starts.
If your animation sequence takes longer, you'll have to add the total amount of time together and change the timing, or it will be out of sync.
The same apllies for all durations used. If you change the total amount of time, make sure to change the duartion.
-->
<set id="fs1" attributeName="display" attributeType="xml" to="inline" begin="0s; fs2.end-1.6s" dur="1.6s"/>
<set id="fs2" attributeName="display" attributeType="xml" to="inline" begin="fs1.end" dur="1.6s"/>
</g>
</svg>Users browsing this forum: No registered users and 1 guest