CSS特效

简介: CSS特效

水波球

HTML

<div class="container">
     <div class="wave"></div>
</div>

CSS3代码

/*容器显示外层圆框和居中*/
        .container {
            position: absolute;
            width: 150px;
            height: 150px;
            padding: 5px;
            /*外层圆框及颜色*/
            border: 5px solid rgb(118, 218, 255);
            /*居中核心代码*/
            /*先让container左上角和父容器中心对齐*/
            top: 50%;
            left: 50%;
            /*在向左和向上平移container宽和高的一半*/
            transform: translate(-50%, -50%);
            /*这会让container变成一个圆形*/
            border-radius: 50%;
            overflow: hidden;
        }
        .wave {
            position: relative;
            width: 150px;
            height: 150px;
            background-color: rgb(118, 218, 255);
            border-radius: 50%;
            box-shadow: inset 0 0 30px 0 rgba(0,0,0,.5), 0 4px 10px 0 rgba(0,0,0,.5);
            /*水波通用代码*/
            &::before,
            &::after{
                content: "";
                position: absolute;
                /*大小一定要是显示部分的二倍*/
                width: 300px;
                height: 300px;
                top: 0;
                left: 50%;
                background-color: rgba(255, 255, 255, .4);
                /*圆角45度市水波的关键*/
                border-radius: 45%;
                transform: translate(-50%, -70%) rotate(0);
                animation: rotatekeyframe 6s linear infinite;
                z-index: 10;
            }
            /*为了做两层水波*/
            &::after {
                border-radius: 47%;
                background-color: rgba(255, 255, 255, .9);
                transform: translate(-50%, -70%) rotate(0);
                animation: rotatekeyframe 10s linear -5s infinite;
                z-index: 20;
            }
        }
        /*&::before和&::after的旋转效果*/
        @keyframes rotatekeyframe {
            50% {
                transform: translate(-50%, -73%) rotate(180deg);
            } 100% {
                  transform: translate(-50%, -70%) rotate(360deg);
            }
        }

相关文章
|
2月前
|
前端开发 UED
用CSS3实现惊艳的过渡动画(建议收藏)
用CSS3实现惊艳的过渡动画(建议收藏)
|
5月前
|
前端开发
css3动画
css3动画
39 0
|
5月前
|
Web App开发 前端开发
CSS3 动画
CSS3 动画
51 0
|
11月前
|
机器学习/深度学习 XML 前端开发
css3动画有哪些?
CSS动画(CSS Animations)是为层叠样式表建议的允许可扩展标记语言(XML)元素使用CSS的动画的模块 常见的动画效果有很多,如平移、旋转、缩放等等,复杂动画则是多个简单动画的组合 css实现动画的方式,有如下几种:
96 0
|
机器学习/深度学习 前端开发
css3动画详解
css3动画详解
95 0
|
前端开发
CSS的常用动画
酷炫的动画效果
76 0
CSS的常用动画
|
安全 前端开发
CSS——“旋转木马”’效果
“旋转木马”’效果
150 0
|
前端开发 UED
CSS 动画效果
在前端开发中,动画效果是一个非常重要的部分。通过动画效果,可以让页面变得更加生动、更加有趣,增强用户体验。CSS 动画效果是一种常用的前端开发技术,通过 CSS 属性来实现各种动画效果,如淡入淡出、缩放、旋转、位移等。
128 0
CSS 06 动画
css3动画 @keyframes关键帧 <div class="rect"> </div> .rect{ width:100px; height:100px; background-color:red; position:flexde; animation: mymove 2s infinite; } @keyframes mymove{ //方法一 首帧和尾帧 from{ top:0; left:20%; } to{ top:0; left:80%