css3旋转的地球,旋转的地球css3

css3果然博大精深:

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

html:

css:

.ball .shadow {

position: absolute;

width: 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;

}

效果:

1f5f2a83d930558762cfcc06f9d9cc33.png

2.下面才是重点:

旋转的地球

* {margin:0; padding:0; border:0;}

.ball {

display: inline-block;

width: 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%;

width: 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%;

width: 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;

width: 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 {

width: 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 {

width: 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; } }

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

2

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

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

鼠标HOVER时区块动画旋转变色的CSS3样式掩码

鼠标hover时区块动画旋转变色的css3样式掩码

C++ otlv4 连接 sql server 数据库小记

otlv4介绍: http://otl.sourceforge.net/ 测试代码 // testotlv4.cpp : 定义控制台应用程序的入口点. // #include "stdafx ...

软件工程(FZU2015) 赛季得分榜,第七回合

SE_FZU目录:1 2 3 4 5 6 7 8 9 10 11 12 13 积分规则 积分制: 作业为10分制,练习为3分制:alpha30分: 团队项目分=团队得分+个人贡献分 个人贡献分: 个人 ...

[模板]ETT

解:splay维护括号序列,就是进子树一次出子树一次.树上每个点直接记录这两个点的编号. 建树的时候按照分配的编号建树. #include typedef ...

Python 2维数组90度旋转

一.二维列表 a = [[col for col in range(4)] for row in range(4)] [[0, 1, 2, 3], [0, 1, 2, 3], [0, 1, 2, 3] ...

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
使用CSS3的transform属性可以实现一张地球图片的3D旋转效果。首先,我们需要将图片设置为3D效果的容器,可以使用CSS的perspective属性设置透视视角。 例如,我们可以在HTML中创建一个div元素,并将其类名设置为"earth-container",代码如下: <div class="earth-container"> <img src="earth.jpg" class="earth-image"> </div> 然后,在CSS中,我们可以设置earth-container类的样式来实现3D旋转效果的地球图片。首先,我们需要使用perspective属性设置透视视角,例如设置为1000px: .earth-container { perspective: 1000px; } 然后,我们可以设置earth-container类内部的img元素的样式来实现旋转效果。我们可以使用transform属性来对图片进行旋转,例如使用rotateY属性来实现绕Y轴的旋转效果,设置为一定的角度值,例如设置为180度: .earth-image { transform: rotateY(180deg); transition: transform 1s ease; } 这样,当我们将页面上的地球图片鼠标放在上方时,地球图片就会以3D的效果绕Y轴旋转180度。 不仅如此,我们还可以通过添加其他动画效果来增加地球图片的3D旋转效果,例如添加过渡效果,使旋转更加平滑。以上代码中的transition属性就用于设置变换效果的过渡时间和动画的速度曲线。 通过这样的方式,我们就可以实现一张地球图片的3D旋转效果。当然,还可以根据需求进行更多样式的调整和细化,使旋转效果更加丰富与醒目。

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值