本文小编为大家详细介绍“css如何实现吃豆豆加载动画效果”,内容详细,步骤清晰,细节处理妥当,希望这篇“css如何实现吃豆豆加载动画效果”文章能帮助大家解决疑惑,下面跟着小编的思路慢慢深入,一起来学习新知识吧。
豆豆加载效果
point_down:html代码:
<div class="demo">
<div class="pacman"></div>
<div class="dot"></div>
point_down:css代码:
<style>
@-webkit-keyframes up {
0%, 100% { transform: rotate(0);
}
50% {
transform: rotate(-30deg);
}
}
@-moz-keyframes up {
0%, 100% {
transform: rotate(0);
}
50% {
transform: rotate(-30deg);
}
}
@-o-keyframes up {
0%, 100% {
transform: rotate(0);
}
50% {
transform: rotate(-30deg);
}
}
@keyframes up {
0%, 100% {
transform: rotate(0);
}
50% {
transform: rotate(-30deg);
}
}
@-webkit-keyframes down {
0%, 100% {
transform: rotate(0);
}
50% {
transform: rotate(30deg);
}
}
@-moz-keyframes down {
0%, 100% {
transform: rotate(0);
}
50% {
transform: rotate(30deg);
}
}
@-o-keyframes down {
0%, 100% {
transform: rotate(0);
}
50% {
transform: rotate(30deg);
}
}
@keyframes down {
0%, 100% {
transform: rotate(0);
}
50% {
transform: rotate(30deg);
}
}
@-webkit-keyframes r-to-l {
100% {
margin-left: -1px;
}
}
@-moz-keyframes r-to-l {
100% {
margin-left: -1px;
}
}
@-o-keyframes r-to-l {
100% {
margin-left: -1px;
}
}
@keyframes r-to-l {
100% {
margin-left: -1px;
}
}
body {
background: #000;
overflow: hidden;
margin: 0;
}
body .pacman:before, body .pacman:after {
content: '';
position: absolute;
background: #FFC107;
width: 100px;
height: 50px;
left: 50%;
top: 50%;
margin-left: -50px;
margin-top: -50px;
border-radius: 50px 50px 0 0;
-webkit-animation: up 0.4s infinite;
-moz-animation: up 0.4s infinite;
-o-animation: up 0.4s infinite;
animation: up 0.4s infinite;
}
body .pacman:after {
margin-top: -1px;
border-radius: 0 0 50px 50px;
-webkit-animation: down 0.4s infinite;
-moz-animation: down 0.4s infinite;
-o-animation: down 0.4s infinite;
animation: down 0.4s infinite;
}
body .dot {
position: absolute;
left: 50%;
top: 50%;
width: 10px;
height: 10px;
margin-top: -5px;
margin-left: 30px;
border-radius: 50%;
background: #ccc;
z-index: -1;
box-shadow: 30px 0 0 #ccc, 60px 0 0 #ccc, 90px 0 0 #ccc, 120px 0 0 #ccc, 150px 0 0 #ccc;
-webkit-animation: r-to-l 0.4s infinite;
-moz-animation: r-to-l 0.4s infinite;
-o-animation: r-to-l 0.4s infinite;
animation: r-to-l 0.4s infinite;
}
</style>
1.行内样式,最直接最简单的一种,直接对HTML标签使用style=""。
2.内嵌样式,就是将CSS代码写在之间,并且用进行声明。
3.外部样式,其中链接样式是使用频率最高,最实用的样式,只需要在之间加上就可以了。其次就是导入样式,导入样式和链接样式比较相似,采用@import样式导入CSS样式表,不建议使用。
读到这里,这篇“css如何实现吃豆豆加载动画效果”文章已经介绍完毕,想要掌握这篇文章的知识点还需要大家自己动手实践使用过才能领会,如果想了解更多相关内容的文章,欢迎关注亿速云行业资讯频道。
亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。