【发布时间】:2019-10-14 00:38:03
【问题描述】:
我有以下 SVG 动画:
演示:https://codepen.io/anon/pen/xNJYGe
HTML:
<div class='batteryIcon'>
<svg version="1.1" id="Ebene_1" xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" viewBox="0 0 668.3 1108.2">
<rect class="power" x="100" y="150" width="470" height="880">
<animate attributeName="height" values="0 ; 880" dur="2.5s" />
</rect>
<polygon class="st0" points="444.9,80.7 444.9,15.8 231.2,15.8 231.2,80.7 40.3,80.7 40.3,1080.8 629.3,1080.8 629.3,80.7 "/>
</svg>
</div>
CSS:
.batteryIcon {
svg {
width: 50px;
display: block;
.st0 {
fill: none;
stroke: #adadad;
stroke-width: 20;
stroke-miterlimit: 5;
}
.power {
fill: #06B67A;
}
}
}
我的问题是动画从_top 到bottom 而不是bottom to top。 我尝试通过 CSS 和内联属性transform 我的矩形,添加 rotate 和 direction 属性以及 keyPoints。到目前为止没有任何效果。
【问题讨论】: