css实现loading的动画图标

1、例

<!DOCTYPE html>
<html>
<head>
    <title>this is animation</title>
    <style type="text/css">
        @keyframes topMove{
            0%{
                transform: rotateZ(0);
            }
            50%{
                transform: rotateZ(45deg);
            }
            100%{
                transform: rotateZ(0);
            }
            
        }
        @keyframes bottomMove{
            0%{
                transform: rotateZ(0);
            }
            50%{
                transform: rotateZ(-45deg);
            }
            100%{
                transform: rotateZ(0);
            }
        }
        @keyframes bollMove{
            from{
                left:260px;
                opacity: 0;
            }
            to{
                left:80px;
                opacity: 1;
                
            }
        }

        *{
            margin: 0;
            padding: 0;
        }
        .first{
            width: 300px;
            height: 300px;
            background-color: skyblue;
            position: relative;
            margin: 0 auto;
        }

        .top{
            margin-top: 30px;
            margin-left: 40px;
            width: 0px;
            height: 0px;
            border: 40px solid #fff;
            border-radius: 50%;
            border-right-color: transparent;
            border-bottom-color: transparent;
            position: absolute;
            animation: topMove 2s linear infinite; 
        }
        .bottom{
            margin-top: 30px;
            margin-left: 40px;
            width: 0px;
            height: 0px;
            border: 40px solid #fff;
            border-radius: 50%;
            border-right-color: transparent;
            border-top-color: transparent;
            position: absolute;
            animation: bottomMove 2s linear infinite; 
        }
        .boll{
            width: 30px;
            height: 30px;
            background-color: #fff;
            position: absolute;
            left:260px;
            margin-top: 55px;
            border-radius: 50%;
            animation: bollMove .5s linear infinite;
        }
    </style>
</head>
<body>

<div class="first">
    <div class="top"></div>
    <div class="bottom"></div>
    <div class="boll" style="animation-delay: 0.2"></div>
    <div class="boll" style="animation-delay: 0.2"></div>
    <div class="boll" style="animation-delay: 0.2"></div>
</div>
</body>
</html>

 

2、例

<!DOCTYPE html>
<html>
<head>
    <title>this is homeword</title>
    <style type="text/css">
        @keyframes movesecond{
            from{
                transform: rotateZ(0deg);
            }
            to{
                transform: rotateZ(360deg);
            }
        }
        @keyframes movethird{
            0%{
                opacity: 0.2;
                transform: scaleX(0.5) scaleY(0.5);

            }
            50%{
                opacity: 1;
                transform: scaleX(1) scaleY(1);

            }
            100%{
                opacity: 0.2;
                transform: scaleX(0.5) scaleY(0.5);
            }
        }
        *{
            margin: 0;
            padding: 0;
        }
        .first{
            width: 300px;
            height: 300px;
            position: relative;
            margin: 0 auto;
            background-color: skyblue;
        }
        .first .second{
            margin-left: 80px;
            margin-top: 80px;
            width: 100px;
            height: 100px;
            border: 10px solid #fff;
            background-color: transparent;
            border-radius: 50%;
            border-top-color: transparent;
            border-bottom-color: transparent;
            animation:movesecond 2s linear infinite; 
            position: absolute;
        }
        .first .third{
            width: 0px;
            height: 0px;
            border: 20px solid #fff;
            border-radius: 50%;
            position: absolute;
            margin-left: 120px;
            margin-top: 115px;
            animation: movethird 2s linear infinite;
        }

    </style>
</head>
<body>

<div class="first">
    <div class="second"></div>
    <div class="third"></div>
</div>
</body>
</html>

 

3、例

<!DOCTYPE html>
<html>
<head>
    <title>this is case2</title>
    <style type="text/css">
        @keyframes move1{
            form{
                transform: rotateZ(0deg);
            }    
            to{
                transform: rotateZ(360deg);
            }
        }
        *{
            margin: 0;
            padding: 0;
        }
        .first{
            width: 300px;
            height: 300px;
            position: relative;
            margin: 0 auto;
            position: relative;
            margin: 0 auto;
            background-color: skyblue;
        }
        .first .second{
            width: 100px;
            height: 100px;
            background-color: transparent;
            border: 10px solid #fff;
            border-radius: 50%;
            position: absolute;
            opacity: 0.5
        }
        .first .third{
            width: 100px;
            height: 100px;
            background-color: transparent;
            border: 10px solid #fff;
            border-radius: 50%;
            border-left-color: transparent;
            border-right-color: transparent;
            border-top-color: transparent;
            position: absolute;
            animation: move1 2s linear infinite;
        }

    </style>
</head>
<body>
<div class="first">
    <div class="second"></div>
    <div class="third"></div>
</div>
</body>
</html>

 

 

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: CSS3遮罩loading是一种常见的网页加载效果,通过使用CSS3的特性来实现。下面是一种简单的实现方式: 首先,在HTML文件中创建一个容器元素,用于包裹loading效果的内容。可以使用一个div元素,设置好宽高和位置。 接着,在CSS文件中给这个容器元素添加样式。可以使用position属性将其定位在页面中心,然后设置背景色和透明度,使其成为一个半透明的遮罩。 然后,在容器元素中添加一个loading效果。可以使用伪类:before或:after来创建一个圆形或旋转的元素。可以使用CSS3的keyframes来设置旋转动画,或者使用transition来实现平滑的过渡效果。 最后,使用JavaScript来监听页面的加载事件,一旦页面的内容加载完毕,就移除这个遮罩层,展示出页面的内容。 总结来说,CSS3遮罩loading是通过使用CSS3的特性来创建一个带有loading效果的遮罩层,用于页面加载时展示loading状态,给用户一个良好的体验。在实现过程中,需要结合HTML、CSS和JavaScript来完成。这种loading效果简单实用,可以根据需求进行灵活的样式和动画设置,提升用户体验。 ### 回答2: CSS3遮罩loading指的是使用CSS3技术实现的一种页面加载动画效果。主要通过遮罩层和旋转动画来展示加载的过程。 首先,我们可以使用一个遮罩层来覆盖整个页面,遮挡住用户的操作,防止用户在加载过程中的干扰。通过设置遮罩层的宽度和高度为100%,使其覆盖整个页面。 接下来,我们可以使用CSS3中的旋转动画来表示加载的过程。通过设置一个旋转的图标(例如一个圆圈或者一个齿轮)在遮罩层的中央,并给这个图标设置一个旋转的动画效果。在CSS3中,我们可以使用关键帧(@keyframes)语法来定义一个旋转动画。通过设置动画的起始状态和结束状态、旋转的角度以及动画的持续时间和重复次数等属性,就可以实现一个旋转的加载动画效果。 最后,加载完成后,可以通过JavaScript或者其他交互方式将遮罩层和加载动画移除,显示真正的页面内容。 总的来说,CSS3遮罩loading通过遮罩层和旋转动画来展示加载过程,使用户在等待加载完成时有了一个视觉的反馈,提升用户体验。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值