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


Posted in HTML / CSS onNovember 16, 2016

先看效果图:

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

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

代码:

<span style="font-size:18px;"><!DOCTYPE html>  
<html>  
<head>  
    <meta charset="utf-8" />  
    <title>模拟摩天轮动画</title>  
    <style>  
    *{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)}    
        }  
    </style>  
</head>  
<body>  
    <div class="div1">  
        <img src="1.png" class="image1">  
        <img src="1.jpg" class="image">  
        <img src="2.jpg" class="image">  
        <img src="3.jpg" class="image">  
        <img src="4.jpg" class="image">   
          
    </div>  
</body>  
</html></span>

 摩天轮原图:

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

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

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

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

HTML / CSS 相关文章推荐
CSS3实现银灰色动画效果的导航菜单代码
Sep 01 HTML / CSS
css3实现文字扫光渐变动画效果的示例
Nov 07 HTML / CSS
CSS3解析抖音LOGO制作的方法步骤
Apr 11 HTML / CSS
CSS3 实现童年的纸飞机
May 05 HTML / CSS
使用jTopo给Html5 Canva中绘制的元素添加鼠标事件
May 15 HTML / CSS
HTML5+CSS3模仿优酷视频截图功能示例
Jan 05 HTML / CSS
HTML5新特性之type=file文件上传功能
Feb 02 HTML / CSS
浅析HTML5中的download属性使用
Mar 13 HTML / CSS
HTML5 客户端数据库简易使用:IndexedDB
Dec 19 HTML / CSS
HTML5跳转小程序wx-open-launch-weapp的示例代码
Jul 16 HTML / CSS
详解CSS不定宽溢出文本适配滚动
May 24 HTML / CSS
CSS使用Flex和Grid布局实现3D骰子
Aug 05 HTML / CSS
IE8下CSS3选择器nth-child() 不兼容问题的解决方法
Nov 16 #HTML / CSS
CSS3 box-sizing属性详解
Nov 15 #HTML / CSS
用CSS3的box-reflect来制作倒影效果
Nov 15 #HTML / CSS
CSS3毛玻璃效果(blur)有白边问题的解决方法
Nov 15 #HTML / CSS
CSS3实现多背景模拟动态边框的效果
Nov 08 #HTML / CSS
CSS3实现同时执行倾斜和旋转的动画效果
Oct 27 #HTML / CSS
CSS3 :not()选择器实现最后一行li去除某种css样式
Oct 19 #HTML / CSS
You might like
PHP操作数组相关函数
2011/02/03 PHP
php时间戳转换的示例
2014/03/31 PHP
PHP获取一个字符串中间一部分字符的方法
2014/08/19 PHP
PHP中str_split()函数的用法讲解
2019/04/11 PHP
javascript编程起步(第五课)
2007/01/10 Javascript
如何使用jQuery Draggable和Droppable实现拖拽功能
2013/07/05 Javascript
将Datatable转化成json发送前台实现思路
2013/09/06 Javascript
javascript中直接引用Microsoft的COM生成Word
2014/01/20 Javascript
微信小程序 页面传参实例详解
2016/11/16 Javascript
JavaScript实现垂直滚动条效果
2017/01/18 Javascript
JavaScript实现时钟滴答声效果
2017/01/29 Javascript
js 只比较时间大小的实例
2017/10/26 Javascript
修改node.js默认的npm安装目录实例
2018/05/15 Javascript
vuex进阶知识点巩固
2018/05/20 Javascript
详解Vue iview IE浏览器不兼容报错(Iview Bable polyfill)
2019/01/07 Javascript
iview form清除校验状态的实现
2019/09/19 Javascript
Selenium执行JavaScript脚本的方法示例
2020/12/31 Javascript
[03:32]2014DOTA2西雅图邀请赛 CIS外卡赛赛前black专访
2014/07/09 DOTA
[57:38]2018DOTA2亚洲邀请赛3月30日 小组赛A组 OpTic VS OG
2018/03/31 DOTA
Python实现Linux下守护进程的编写方法
2014/08/22 Python
python中使用xlrd、xlwt操作excel表格详解
2015/01/29 Python
构建Python包的五个简单准则简介
2015/06/15 Python
Python3学习urllib的使用方法示例
2017/11/29 Python
python逐行读写txt文件的实例讲解
2018/04/03 Python
VSCode下配置python调试运行环境的方法
2018/04/06 Python
Python 3 实现定义跨模块的全局变量和使用教程
2019/07/07 Python
python获取linux系统信息的三种方法
2020/10/14 Python
美国一家主营日韩美妆护肤品的在线商店:iMomoko
2016/09/11 全球购物
微软日本官方网站:Microsoft日本
2017/11/26 全球购物
捷克购买家具网站:JENA nábytek
2020/03/19 全球购物
水电工岗位职责
2015/02/14 职场文书
个人先进事迹总结
2015/02/26 职场文书
员工拾金不昧表扬稿
2015/05/05 职场文书
承兑汇票延期证明
2015/06/23 职场文书
Java并发编程之原子性-Atomic的使用
2022/03/16 Java/Android
Linux中如何安装并部署Redis
2022/04/18 Servers