SVG排版公众号文章『一键黑色变彩色』模板代码

发布于 2021-04-01 00:36

模板效果

模板代码

    <g>        <foreignObject x="0" y="0" width="345" height="1128">            <svg style="display: inline-block;width: 100%;pointer-events: none" width="345px" height="150px">                <foreignObject x="0" y="0" width="345" height="1128">                    <!-- 这个svg设置彩色图片为背景图 -->                    <svg style="display: inline-block;width: 100%;background-image: url(https://mmbiz.qpic.cn/mmbiz_png/JpraGu7eGqTQ4K2BpnzTTeF2HqwRLkWeibPomWu0VW3IJDFHa7DbFZN7Qunjnfhn46CaiaLtavlvjyFjPNkEe6tA/0?wx_fmt=png), url(https://mmbiz.qpic.cn/mmbiz_png/JpraGu7eGqTQ4K2BpnzTTeF2HqwRLkWeLMtDVicoJChicZDJZkASUuxjXEObvmKySpRpMYd5b3TRVaFkyMVwZf8Q/0?wx_fmt=png);background-size: 100% auto, 100% auto;background-repeat: no-repeat, no-repeat;background-position: 0 0, 0 99.5%;pointer-events: none" viewBox="0 0 345 1128" data-author=></svg>                </foreignObject>                <!-- 色彩图片容器展开动画 -->                <animate attributeName="height" values="150;1128" dur="30s" fill="freeze" begin="click" restart="never"></animate>                <g>                    <rect style="pointer-events: painted;" x="0" y="0" width="345" height="150" fill="#000" opacity="0"></rect>                </g>                <g style="pointer-events: none">                    <circle fill="#FA5151" cx="172.5" cy="75" r="44">                        <animate attributeName="opacity" values="1;0.3" dur="1.5s" begin=".2s" repeatCount="indefinite"></animate>                        <animate attributeName="r" values="10;30" dur="1.5s" begin=".2s" repeatCount="indefinite"></animate>                    </circle>                </g>            </svg>        </foreignObject>       </g></svg>

模板分析


懂点君


本文来自网络或网友投稿,如有侵犯您的权益,请发邮件至:aisoutu@outlook.com 我们将第一时间删除。

相关素材