当前位置: 代码网 > it编程>网页制作>Css > CSS3 实现飘动的云朵动画

CSS3 实现飘动的云朵动画

2020年12月01日 Css 我要评论
CSS3 实现飘动的云朵动画这篇文章主要介绍了CSS3 实现飘动的云朵动画,帮助大家更好的理解和学习css3的使用,感兴趣的朋友可以了解下... 20-12-01

运行效果

html

<head>
  <meta charset='utf-8'>
  <title>css3 cloud animations by montana flynn</title>
</head>

<body>
  <div class="sky">
    <div class="moon"></div>
    <div class="clouds_two"></div>
    <div class="clouds_one"></div>
    <div class="clouds_three"></div>
  </div>
</body>

css

html, body {
  margin: 0;
  height: 100%
}

.sky {
  height: 480px;
  background: #007fd5;
  position: relative;
  overflow: hidden;
  -webkit-animation: sky_background 50s ease-out infinite;
  -moz-animation: sky_background 50s ease-out infinite;
  -o-animation: sky_background 50s ease-out infinite;
  -webkit-transform: translate3d(0, 0, 0);
  -moz-transform: translate3d(0, 0, 0);
  -o-transform: translate3d(0, 0, 0)
}

.moon {
  background: url("http://i.imgur.com/wfxd68n.png");
  position: absolute;
  left: 0;
  height: 300%;
  width: 300%;
  -webkit-animation: moon 50s linear infinite;
  -moz-animation: moon 50s linear infinite;
  -o-animation: moon 50s linear infinite;
  -webkit-transform: translate3d(0, 0, 0);
  -moz-transform: translate3d(0, 0, 0);
  -o-transform: translate3d(0, 0, 0)
}

.clouds_one {
  background: url("http://www.scri8e.com/stars/png_clouds/zc06.png?filename=./zc06.png&w0=800&h0s=289&imgtype=3&h1=50&w1=140");
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 300%;
  -webkit-animation: cloud_one 50s linear infinite;
  -moz-animation: cloud_one 50s linear infinite;
  -o-animation: cloud_one 50s linear infinite;
  -webkit-transform: translate3d(0, 0, 0);
  -moz-transform: translate3d(0, 0, 0);
  -o-transform: translate3d(0, 0, 0)
}

.clouds_two {
  background: url("http://freepngimages.com/wp-content/uploads/2016/02/clouds-transparent-background-2.png");
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 300%;
  -webkit-animation: cloud_two 75s linear infinite;
  -moz-animation: cloud_two 75s linear infinite;
  -o-animation: cloud_two 75s linear infinite;
  -webkit-transform: translate3d(0, 0, 0);
  -moz-transform: translate3d(0, 0, 0);
  -o-transform: translate3d(0, 0, 0)
}

.clouds_three {
  background: url("http://montanaflynn.me/lab/css-clouds/images/cloud_three.png");
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 300%;
  -webkit-animation: cloud_three 100s linear infinite;
  -moz-animation: cloud_three 100s linear infinite;
  -o-animation: cloud_three 100s linear infinite;
  -webkit-transform: translate3d(0, 0, 0);
  -moz-transform: translate3d(0, 0, 0);
  -o-transform: translate3d(0, 0, 0)
}

@-webkit-keyframes sky_background {
  0% {
    background: #007fd5;
    color: #007fd5
  }
  50% {
    background: #000;
    color: #a3d9ff
  }
  100% {
    background: #007fd5;
    color: #007fd5
  }
}

@-webkit-keyframes moon {
  0% {
    opacity: 0;
    left: -200% -moz-transform: scale(0.5);
    -webkit-transform: scale(0.5);
  }
  50% {
    opacity: 1;
    -moz-transform: scale(1);
    left: 0% bottom: 250px;
    -webkit-transform: scale(1);
  }
  100% {
    opacity: 0;
    bottom: 500px;
    -moz-transform: scale(0.5);
    -webkit-transform: scale(0.5);
  }
}

@-webkit-keyframes cloud_one {
  0% {
    left: 0
  }
  100% {
    left: -200%
  }
}

@-webkit-keyframes cloud_two {
  0% {
    left: 0
  }
  100% {
    left: -200%
  }
}

@-webkit-keyframes cloud_three {
  0% {
    left: 0
  }
  100% {
    left: -200%
  }
}

@-moz-keyframes sky_background {
  0% {
    background: #007fd5;
    color: #007fd5
  }
  50% {
    background: #000;
    color: #a3d9ff
  }
  100% {
    background: #007fd5;
    color: #007fd5
  }
}

@-moz-keyframes moon {
  0% {
    opacity: 0;
    left: -200% -moz-transform: scale(0.5);
    -webkit-transform: scale(0.5);
  }
  50% {
    opacity: 1;
    -moz-transform: scale(1);
    left: 0% bottom: 250px;
    -webkit-transform: scale(1);
  }
  100% {
    opacity: 0;
    bottom: 500px;
    -moz-transform: scale(0.5);
    -webkit-transform: scale(0.5);
  }
}

@-moz-keyframes cloud_one {
  0% {
    left: 0
  }
  100% {
    left: -200%
  }
}

@-moz-keyframes cloud_two {
  0% {
    left: 0
  }
  100% {
    left: -200%
  }
}

@-moz-keyframes cloud_three {
  0% {
    left: 0
  }
  100% {
    left: -200%
  }
}

以上就是css3 实现飘动的云朵动画的详细内容,更多关于css3 飘动的云的资料请关注代码网其它相关文章!

(0)

相关文章:

  • CSS3 实现的缩略图悬停效果

    CSS3 实现的缩略图悬停效果

    CSS3 实现的缩略图悬停效果这篇文章主要介绍了CSS3 实现的缩略图悬停效果的示例代码帮助大家更好的理解和使用CSS3,感兴趣的朋友可以了解下... 20-... [阅读全文]
  • CSS3贝塞尔曲线示例:创建链接悬停动画效果

    CSS3贝塞尔曲线示例:创建链接悬停动画效果

    CSS3贝塞尔曲线示例:创建链接悬停动画效果这篇文章主要介绍了CSS3贝塞尔曲线示例:创建链接悬停动画效果,帮助大家更好的理解和制作CSS3特效,感兴趣的朋友... [阅读全文]
  • html+css3实现的登录界面

    html+css3实现的登录界面

    html+css3实现的登录界面这篇文章主要介绍了html+css3实现的登录界面的示例代码,帮助大家更好的制作网页,感兴趣的朋友可以了解下... 20-12... [阅读全文]
  • CSS3实现菜单悬停效果

    CSS3实现菜单悬停效果

    CSS3实现菜单悬停效果这篇文章主要介绍了CSS3实现菜单悬停效果的示例代码,帮助大家更好的制作CSS3特效,美化网页,感兴趣的朋友可以了解下... 20-1... [阅读全文]
  • css3中flex布局宽度不生效的解决

    css3中flex布局宽度不生效的解决这篇文章主要介绍了css3中flex布局宽度不生效的解决,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的…

    2020年12月09日 网页制作
  • 详解CSS3:overflow属性

    详解CSS3:overflow属性

    详解CSS3:overflow属性这篇文章主要介绍了详解CSS3:overflow属性的相关资料,帮助大家更好的理解和制作CSS3特效,感兴趣的朋友可以了解下... [阅读全文]

版权声明:本文内容由互联网用户贡献,该文观点仅代表作者本人。本站仅提供信息存储服务,不拥有所有权,不承担相关法律责任。 如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 2386932994@qq.com 举报,一经查实将立刻删除。

发表评论

验证码:
Copyright © 2017-2025  代码网 保留所有权利. 粤ICP备2024248653号
站长QQ:2386932994 | 联系邮箱:2386932994@qq.com