Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/svg/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
从下到上填充SVG_Svg - Fatal编程技术网

从下到上填充SVG

从下到上填充SVG,svg,Svg,我有一个SVG,我正在尝试用填充从下到上设置动画。我希望它以颜色代码#ddd开始,并以#ccc结束,在1秒的时间内从底部填充。我很难让它正常工作,因为它看起来有点奇怪 这就是我到目前为止得到的 <svg width="30px" height="30px" viewBox="0 0 30 30" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">

我有一个SVG,我正在尝试用填充从下到上设置动画。我希望它以颜色代码
#ddd
开始,并以
#ccc
结束,在1秒的时间内从底部填充。我很难让它正常工作,因为它看起来有点奇怪

这就是我到目前为止得到的

<svg width="30px" height="30px" viewBox="0 0 30 30" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
    <g id="Dashboard" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
    <linearGradient id="lg" x1="0.5" y1="1" x2="0.5" y2="0">
                <stop offset="0%"  stop-color="#ddd"/>
                <stop offset="50%" stop-color="#ccc">
                  <animate attributeName="offset" values="0;1;0"  dur="1s" begin="0s"/>
                </stop>
                <stop offset="100%" stop-opacity="1" stop-color="#ccc">
                  <animate attributeName="offset" values="0;1;0"  dur="1s"  begin="0s"/>
                </stop> 
            </linearGradient>
        <g transform="translate(-1161.000000, -558.000000)" fill="url(#lg)" id="current-net-wealth">
            <g transform="translate(437.000000, 475.000000)">
                <g id="houses" transform="translate(340.000000, 83.000000)">
                    <g id="house" transform="translate(384.000000, 0.000000)">
                        <polygon id="Path" points="21 6.66002593 21 3 25 3 25 11.1000432 30 16.6500648 25.3846154 16.6500648 25.3846154 30 4.61538462 30 4.62306431 16.6500648 0 16.6500648 15 0"></polygon>
                    </g>
                </g>
            </g>
        </g>
    </g>
</svg>

我是否需要为
linearGradiant
动画添加额外的停止点?

类似的内容

  • 如果你想要1秒的持续时间,那么这就是要写的
  • 您的值使填充再次上下移动
  • fill=“freeze”使动画值在其持续时间结束后保持不变
  • 你的颜色和你说的不相配

谢谢,对不起,我在代码框中粘贴了错误的版本。我已经更新了原来的帖子。