XML SVG - persist the end state of an animation

前端 未结 1 1436
-上瘾入骨i
-上瘾入骨i 2021-01-12 20:32

After the end of an AnimateTransform action, the element snaps back to the original value.
This isn\'t exactly unexpected as it\'s in the SMIL documentation:

相关标签:
1条回答
  • 2021-01-12 21:11

    fill="freeze" will persist the state of an animation e.g.

    <svg width="200" height="200" viewBox="0 0 100 100"
         xmlns="http://www.w3.org/2000/svg" 
         xmlns:xlink="http://www.w3.org/1999/xlink">
      <rect id="outline" stroke="black" fill="white" 
            width="100" height="100" >
        <animateTransform id="one"
                          attributeType="XML"
                          attributeName="transform"
                          type="translate"
                          from="0" to="-7"
                          dur="1s" repeatCount="1"
                          fill="freeze"/>
      </rect>
    </svg>

    0 讨论(0)
提交回复
热议问题