svg下css定位和添加css3动画之后定位失效问题 解决小红包酬谢

html-css09

svg下css定位和添加css3动画之后定位失效问题 解决小红包酬谢,第1张

搜了几篇老外的文章,提到 svg 的 forginObject 内的 HTML 元素,当应用 CSS3 动画时,动画的 transform-origin 是基于最外层 body 定位的,貌似无解。

个人建议使用 svg 的 SMIL 动画来实现波纹特效,你大屏展示用的话,兼容性啥的应该不是主要问题。写了简单示例代码:

<!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <meta http-equiv="X-UA-Compatible" content="ie=edge">

    <title>svg 动画示例</title>

    <style>

    html,

    body,

    svg {

        width: 100%

        height: 100%

    }

    body {

        padding: 0

        margin: 0

        background: #232323

    }

    .eanimation {

        stroke: rgb(181, 255, 255)

        box-shadow: inset 0px 0px 8px rgba(29, 146, 226, 0.75)

    }

    </style>

</head>

<body>

    <svg xmlns="http://www.w3.org/2000/svg">

        <g>

            <g>

                <circle class="eanimation" cx="200" cy="200" r="96" stroke-width="3" fill="transparent"/>

                <animateTransform

                 attributeName="transform"

                 type="scale"

                 dur="1s"

                 values="0.51"

                 repeatCount="indefinite"/>

            </g>

            <g>

                <circle class="eanimation" cx="200" cy="200" r="96" stroke-width="3" fill="transparent"/>

                <animateTransform

                    attributeName="transform"

                    type="scale"

                    dur="1s"

                    values="0.651"

                    additive="sum"

                    repeatCount="indefinite"/>

            </g>

            <animate attributeName="opacity" begin="0s" dur="1s" from="1" to="0" repeatCount="indefinite"/>

        </g>

    </svg>

</body>

</html>

PS软件和插件免费下载  

链接:https://pan.baidu.com/s/1q7t4toI0uXU1aFEE-7WYAA

提取码:sph8  

Photoshop主要处理以像素所构成的数字图像。使用其众多的编修与绘图工具,可以有效地进行图片编辑工作。ps有很多功能,在图像、图形、文字、视频、出版等各方面都有涉及。