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 相关文章推荐
浅析两列自适应布局的3种思路
May 03 HTML / CSS
CSS3截取字符串实例代码【推荐】
Jun 07 HTML / CSS
css3.0新属性效果在ie下的解决方案
May 10 HTML / CSS
魔幻般冒泡背景的CSS3按钮动画
Feb 27 HTML / CSS
实例讲解CSS3中的box-flex弹性盒属性布局
Jun 09 HTML / CSS
CSS3 @media的基本用法总结
Sep 10 HTML / CSS
HTML5的革新 结构之美
Jun 20 HTML / CSS
HTML5之SVG 2D入门6—视窗坐标系与用户坐标系及变换概述
Jan 30 HTML / CSS
极简的HTML5模版
Jul 09 HTML / CSS
利用Storage Event实现页面间通信的示例代码
Jul 26 HTML / CSS
CSS布局之浮动(float)和定位(position)属性的区别
Sep 25 HTML / CSS
CSS list-style-type属性使用方法
May 21 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
IIS6+PHP5+MySQL5+Zend Optimizer+phpMyAdmin安装配置图文教程 2009年
2009/06/08 PHP
php汉字转拼音的示例
2014/02/27 PHP
PHP输出缓存ob系列函数详解
2014/03/11 PHP
PHP实现字符串的全排列详解
2019/04/24 PHP
用倒置滤镜把div倒置,再把table倒置。
2007/07/31 Javascript
Javascript 面向对象(二)封装代码
2012/05/23 Javascript
javascript中[]和{}对象使用介绍
2013/03/20 Javascript
Javascript 浮点运算的问题分析与解决方法
2013/08/27 Javascript
jQuery 如何先创建、再修改、后添加DOM元素
2014/05/20 Javascript
javascript常用函数(2)
2015/11/05 Javascript
js针对ip地址、子网掩码、网关的逻辑性判断
2016/01/06 Javascript
浅谈js图片前端预览之filereader和window.URL.createObjectURL
2016/06/30 Javascript
浅述节点的创建及常见功能的实现
2016/12/15 Javascript
js实现3d悬浮效果
2017/02/16 Javascript
jQuery获取table下某一行某一列的值实现代码
2017/04/07 jQuery
基于js 字符串indexof与search方法的区别(详解)
2017/12/04 Javascript
10分钟彻底搞懂Http的强制缓存和协商缓存(小结)
2018/08/30 Javascript
使用Vuex解决Vue中的身份验证问题
2018/09/28 Javascript
node+multer实现图片上传的示例代码
2020/02/18 Javascript
[02:22]《新闻直播间》2017年08月14日
2017/08/15 DOTA
Python实现模拟时钟代码推荐
2015/11/08 Python
Python如何快速上手? 快速掌握一门新语言的方法
2017/11/14 Python
OpenCV-Python实现轮廓检测实例分析
2018/01/05 Python
Python实现可设置持续运行时间、线程数及时间间隔的多线程异步post请求功能
2018/01/11 Python
Python OpenCV 使用滑动条来调整函数参数的方法
2019/07/08 Python
python实现的批量分析xml标签中各个类别个数功能示例
2019/12/30 Python
Python中的特殊方法以及应用详解
2020/09/20 Python
python 利用openpyxl读取Excel表格中指定的行或列教程
2021/02/06 Python
俄罗斯最大的消费电子连锁零售商:Mvideo
2017/06/25 全球购物
奥兰多迪士尼门票折扣:Undercover Tourist
2018/07/09 全球购物
一加手机美国官方网站:OnePlus美国
2019/09/19 全球购物
旅游管理专业学生求职信
2013/09/28 职场文书
服务之星获奖感言
2014/01/21 职场文书
产品发布会策划方案
2014/05/12 职场文书
2015年后勤工作总结范文
2015/04/08 职场文书
apache虚拟主机配置的三种方式(小结)
2022/07/23 Servers