Say I have an SVG image with several top-level "g" elements like this:
<svg>
<g id="id1">...</g>
<g id="id2">...</g>
<g id="id3">...</g>
...
</svg>
Now I'd like to show only the one with id1
in the beginning, sliding through id2
, id3
and so on as the user repeatedly clicks on the image (similar to a powerpoint presentation). I tried this as a first step:
<animate xlink:href="#id2" attributeName="opacity" from="0" to="0" dur="0s" begin="0s"/>
<animate xlink:href="#id3" attributeName="opacity" from="0" to="0" dur="0s" begin="0s"/>
...
<animate xlink:href="#id2" attributeName="opacity" from="0" to="100" dur="0.25s" begin="click" id="anim1"/>
<animate xlink:href="#id1" attributeName="opacity" from="100" to="0" dur="0.25s" begin="anim1.begin" id="anim2"/>
...
The first lines are supposed to make all images transparent except the id1
image - which works fine. The next two lines are supposed to make id1
transparant and show id2
- which doesn't work. I assume that the transparent images with higher ids are on higher levels (in z-direction) and block the click events of the lower images. But I don't know how to make them "dissappear" completely or whatever.
And probably there's a better way to do this anyway...?