zoukankan      html  css  js  c++  java
  • 旋转的地球css3

    css3果然博大精深:

    1.代码里面还有用box-shadow制作椭圆形阴影的效果,厉害了!之前找了好久都没找到,今天给找到了

    html:

    <section class="stage">
        <figure class="ball">
        	<span class="shadow"></span>
        </figure>
      </section>
    

    css:

    .ball .shadow {
        position: absolute;
         100%;
        height: 100%;
        background: radial-gradient(circle at 50% 50%, rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.1) 40%, rgba(0, 0, 0, 0) 50%);
        -webkit-transform: rotateX(90deg) translateZ(-150px);
        -moz-transform: rotateX(90deg) translateZ(-150px);
        -ms-transform: rotateX(90deg) translateZ(-150px);
        -o-transform: rotateX(90deg) translateZ(-150px);
        transform: rotateX(90deg) translateZ(-150px);
        z-index: -1;
    }
    

    效果:  

    2.下面才是重点:

    <!doctype html>  
    <html>  
    <head>  
    <meta charset="utf-8">  
    <title>旋转的地球</title>  
    <style>  
    	* {margin:0; padding:0; border:0;}  
    	.ball {
    	  display: inline-block;
    	   100%;
    	  height: 100%;
    	  margin: 0;
    	  border-radius: 50%;
    	  position: relative;
    	  -webkit-transform-style: preserve-3d;
    	  background: url('http://hop.ie/balls/images/world-map-one-color.png') repeat-x;
    	  background-size: auto 100%;
    	  -webkit-animation: move-map 30s infinite linear;
    	  -moz-animation: move-map 30s infinite linear;
    	  -o-animation: move-map 30s infinite linear;
    	  -ms-animation: move-map 30s infinite linear;
    	  animation: move-map 30s infinite linear;
    	}
    
    	.ball:before {
    	  content: "";
    	  position: absolute;
    	  top: 0%;
    	  left: 0%;
    	   100%;
    	  height: 100%;
    	  border-radius: 50%;
    	  box-shadow: -40px 10px 70px 10px rgba(0,0,0,0.5) inset;
    	  z-index: 2;
    	}
    
    	.ball:after {
    	  content: "";
    	  position: absolute;
    	  border-radius: 50%;
    	   100%;
    	  height: 100%;
    	  top: 0;
    	  left: 0;
    	  -webkit-filter: blur(0);
    	  opacity: 0.3;
    	  background: radial-gradient(circle at 50% 80%, #81e8f6, #76deef 10%, #055194 66%, #062745 100%);
    	}
    
    	.ball .shadow {
    	  position: absolute;
    	   100%;
    	  height: 100%;
    	  background: radial-gradient(circle at 50% 50%, rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.1) 40%, rgba(0, 0, 0, 0) 50%);
    	  -webkit-transform: rotateX(90deg) translateZ(-150px);
    	  -moz-transform: rotateX(90deg) translateZ(-150px);
    	  -ms-transform: rotateX(90deg) translateZ(-150px);
    	  -o-transform: rotateX(90deg) translateZ(-150px);
    	  transform: rotateX(90deg) translateZ(-150px);
    	  z-index: -1;
    	}
    	body {
    	   300px;
    	  margin: 20px auto;
    	  background: linear-gradient(to bottom, rgba(100, 100, 100, 0.2) 0%, rgba(255, 255, 255, 0.5) 40%, #ffffff 100%);
    	  background-repeat: no-repeat;
    	}
    
    	.stage {
    	   300px;
    	  height: 300px;
    	  display: inline-block;
    	  margin: 20px;
    	  -webkit-perspective: 1200px;
    	  -moz-perspective: 1200px;
    	  -ms-perspective: 1200px;
    	  -o-perspective: 1200px;
    	  perspective: 1200px;
    	  -webkit-perspective-origin: 50% 50%;
    	  -moz-perspective-origin: 50% 50%;
    	  -ms-perspective-origin: 50% 50%;
    	  -o-perspective-origin: 50% 50%;
    	  perspective-origin: 50% 50%;
    	}
    
    	@-moz-keyframes move-map {
    	  0% {
    	    background-position: -849px 0; }
    
    	  100% {
    	    background-position: 0 0; } }
    
    	@-webkit-keyframes move-map {
    	  0% {
    	    background-position: 0 0; }
    	  100% {
    	    background-position: -849px 0; }
    	}
    
    
    	@-o-keyframes move-map {
    	  0% {
    	    background-position: -849px 0; }
    
    	  100% {
    	    background-position: 0 0; } }
    
    	@-ms-keyframes move-map {
    	  0% {
    	    background-position: -849px 0; }
    
    	  100% {
    	    background-position: 0 0; } }
    
    	@keyframes move-map {
    	  0% {
    	    background-position: -849px 0; }
    
    	  100% {
    	    background-position: 0 0; } } 
    </style>  
    </head> 
    <body>  
    	<section class="stage">
        <figure class="ball">
        	<span class="shadow"></span>
        </figure>
      </section> 
    </body>  
    </html> 
    

    可以复制上面的代码到框框中运行试试哦! 

    还有更好玩的css3:http://www.w3cplus.com/css3/spheres.html

    有时间一定要自己写写!^_^

  • 相关阅读:
    Mapreduce 工作机制图,MapReduce组合式,迭代式,链式
    win7安装 git软件,如何使用git上传本地代码
    新技术架起 Oracle、Hadoop、NoSQL数据存储之间的桥梁
    Commons-logging + Log4j 使用方法、常见问题
    数据挖掘_面试题一
    未来10年是大数据价值变现的阶段
    数据挖掘十大经典算法
    Java环境变量详细设置
    Hadoop中NameNode、DataNode和Client三者之间的通信方式是什么?怎样进行合作?
    在线图片无损压缩
  • 原文地址:https://www.cnblogs.com/mmzuo-798/p/6828134.html
Copyright © 2011-2022 走看看