【发布时间】:2020-12-15 11:29:54
【问题描述】:
我正在尝试制作带有线条和圆形的 SVG 动画。线条应该是动画的,圆圈应该相对于线条高度移动。这条线应该从 div 的底部开始,在动画后它应该用圆圈实现 div 广告的顶部,然后应该动画到底部,然后从底部到顶部,从顶部到底部一直只有一个,除非 - 如果用户将鼠标悬停在圆圈上它应该停止,如果用户将鼠标悬停在圆圈上,它应该在停止时开始。
div {
height: 100px;
}
<div>
<svg xmlns="http://www.w3.org/2000/svg" width="171" height="728" viewBox="0 0 171 728">
<defs><style>.a{fill:#000;}</style></defs><circle class="a" cx="85.5" cy="85.5" r="85.5"></circle>
<rect class="a" width="7" height="0" transform="translate(82 113)">
<animate id="animation"
attributeName="height"
attributeType="XML"
from="0" to="615"
begin="0s" dur="5s"
fill="freeze" />
<animate id="animation2"
attributeName="height"
attributeType="XML"
from="615" to="0"
begin="5s" dur="10s"
fill="freeze" />
</rect>
</svg>
</div>
【问题讨论】:
标签: svg svg-animate