html摩天轮效果,CSS3 2D模拟实现摩天轮旋转效果

先看效果图:

aa8987e657334e88c4985114651dcc59.gif

由于上传的大小原因,只能录制成这种效果,原图是无限循环的转圈。

代码:

模拟摩天轮动画

*{margin:0;padding:0;}

.image{width:80px;height:80px;}

.image1{width:620px;height:620px;}

.div1{position:relative;margin:10px auto;width:638px;

animation:run 20s linear infinite;

-webkit-animation:run 20s linear infinite;

-moz-animation:run 20s linear infinite;

-o-animation:run 20s linear infinite;

}

img:nth-child(2){

position:absolute;top:25px;left:270px;opacity:0.7;

animation:run2 20s linear infinite;

-webkit-animation:run2 20s linear infinite;

-moz-animation:run2 20s linear infinite;

-o-animation:run2 20s linear infinite;

transform-origin:top center;

-webkit-transform-origin:top center;

-moz-transform-origin:top center;

-o-transform-origin:top center;

}

img:nth-child(3){

position:absolute;top:580px;left:270px;opacity:0.7;

animation:run2 20s linear infinite;

-webkit-animation:run2 20s linear infinite;

-moz-animation:run2 20s linear infinite;

-o-animation:run2 20s linear infinite;

transform-origin:top center;

-webkit-transform-origin:top center;

-moz-transform-origin:top center;

-o-transform-origin:top center;

}

img:nth-child(4){

position:absolute;top:300px;left:550px;opacity:0.7;

animation:run2 20s linear infinite;

-webkit-animation:run2 20s linear infinite;

-moz-animation:run2 20s linear infinite;

-o-animation:run2 20s linear infinite;

transform-origin:top center;

-webkit-transform-origin:top center;

-moz-transform-origin:top center;

-o-transform-origin:top center;

}

img:nth-child(5){

position:absolute;top:300px;left:0px;opacity:0.7;

animation:run2 20s linear infinite;

-webkit-animation:run2 20s linear infinite;

-moz-animation:run2 20s linear infinite;

-o-animation:run2 20s linear infinite;

transform-origin:top center;

-webkit-transform-origin:top center;

-moz-transform-origin:top center;

-o-transform-origin:top center;

}

@keyframes run

{

0%{transform:rotate(0deg)}

100%{transform:rotate(360deg)}

}

@-webkit-keyframes run

{

0%{-webkit-transform:rotate(0deg)}

100%{-webkit-transform:rotate(360deg)}

}

@-moz-keyframes run

{

0%{-moz-transform:rotate(0deg)}

100%{-moz-transform:rotate(360deg)}

}

@-o-keyframes run

{

0%{-o-transform:rotate(0deg)}

100%{-o-transform:rotate(360deg)}

}

@keyframes run2

{

0%{transform:rotate(0deg)}

100%{transform:rotate(-360deg)}

}

@-webkit-keyframes run2

{

0%{-webkit-transform:rotate(0deg)}

100%{-webkit-transform:rotate(-360deg)}

}

@-moz-keyframes run2

{

0%{-moz-transform:rotate(0deg)}

100%{-moz-transform:rotate(-360deg)}

}

@-o-keyframes run2

{

0%{-o-transform:rotate(0deg)}

100%{-o-transform:rotate(-360deg)}

}

1.png

1.jpg

2.jpg

3.jpg

4.jpg

摩天轮原图:

600686b7f5ef73752fdf03935068e74b.png

注释:transform-origin 属性允许您改变被转换元素的位置。

这个属性主要的作用就是选择一个位置,然后绕着这个位置旋转。

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持脚本之家。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值