0

0

基于HTML5的齿轮动画特效_html5教程技巧

php中文网

php中文网

发布时间:2016-05-16 15:45:54

|

1782人浏览过

|

来源于php中文网

原创

这是一个基于html5的齿轮动画特效,我们将齿轮转动的物理学原理,转换为html5代码,在网页上实现了模拟齿轮转动的动画效果。该齿轮动画的最大特点是它由好多个齿轮组成,这对齿轮传动的算法要求就大大提高了,而且我们并没有用javascript,而是纯css3实现的。

HTML代码

XML/HTML Code复制内容到剪贴板
  1. div id="level">  
  2.  div id="content">  
  3.   div id="gears">  
  4.    div id="gears-static">div>  
  5.    div id="gear-system-1">  
  6.     div class="shadow" id="shadow15">div>  
  7.     div id="gear15">div>  
  8.     div class="shadow" id="shadow14">div>  
  9.     div id="gear14">div>  
  10.     div class="shadow" id="shadow13">div>  
  11.     div id="gear13">div>  
  12.    div>  
  13.    div id="gear-system-2">  
  14.     div class="shadow" id="shadow10">div>  
  15.     div id="gear10">div>  
  16.     div class="shadow" id="shadow3">div>  
  17.     div id="gear3">div>  
  18.    div>  
  19.    div id="gear-system-3">  
  20.     div class="shadow" id="shadow9">div>  
  21.     div id="gear9">div>  
  22.     div class="shadow" id="shadow7">div>  
  23.     div id="gear7">div>  
  24.    div>  
  25.    div id="gear-system-4">  
  26.     div class="shadow" id="shadow6">div>  
  27.     div id="gear6">div>  
  28.     div id="gear4">div>  
  29.    div>  
  30.    div id="gear-system-5">  
  31.     div class="shadow" id="shadow12">div>  
  32.     div id="gear12">div>  
  33.     div class="shadow" id="shadow11">div>  
  34.     div id="gear11">div>  
  35.     div class="shadow" id="shadow8">div>  
  36.     div id="gear8">div>  
  37.    div>  
  38.    div class="shadow" id="shadow1">div>  
  39.    div id="gear1">div>  
  40.    div id="gear-system-6">  
  41.     div class="shadow" id="shadow5">div>  
  42.     div id="gear5">div>  
  43.     div id="gear2">div>  
  44.    div>  
  45.    div class="shadow" id="shadowweight">div>  
  46.    div id="chain-circle">div>  
  47.    div id="chain">div>  
  48.    div id="weight">div>  
  49.   div>  
  50.  div>  
  51. div>  

CSS代码

Interior AI
Interior AI

AI室内设计,上传室内照片自动帮你生成多种风格的室内设计图

下载
CSS Code复制内容到剪贴板
  1. #level{   
  2.  width:100%;   
  3.  height:1px;   
  4.  position:absolute;   
  5.  top:50%;   
  6. }   
  7. #content{   
  8.  text-align:center;   
  9.  margin-top:-327px;   
  10. }   
  11. #gears{   
  12.  width:478px;   
  13.  height:655px;   
  14.  position:relative;   
  15.  display:inline-block;   
  16.  vertical-align:middle;   
  17. }   
  18. #gears-static{   
  19.  background:url(FgFnjks.png) no-repeat -363px -903px;   
  20.  width:329px;   
  21.  height:602px;   
  22.  position:absolute;   
  23.  bottombottom:5px;   
  24.  rightright:0px;   
  25.  opacity:0.4;   
  26. }   
  27. #title{   
  28.  vertical-align:middle;   
  29.  color:#9EB7B5;   
  30.  width:43%;   
  31.  display:inline-block;   
  32. }   
  33. #title h1{   
  34.  font-family'PTSansNarrowBold'sans-serif;   
  35.  font-size:3.6em;   
  36.  text-shadow:rgba(0, 0, 0, 0.36) 7px 7px 10px;   
  37. }   
  38. #title p{   
  39.  font-familysans-serif;   
  40.  font-size:1.2em;   
  41.  line-height:148%;   
  42.  text-shadow:rgba(0, 0, 0, 0.36) 1px 1px 0px;   
  43. }   
  44.   
  45. .shadow{   
  46.  -webkit-box-shadow: 4px 7px 25px 10px rgba(43, 36, 0, 0.36);   
  47.  -moz-box-shadow: 4px 7px 25px 10px rgba(43, 36, 0, 0.36);   
  48.  box-shadow: 4px 7px 25px 10px rgba(43, 36, 0, 0.36);   
  49. }   
  50.   
  51. /*gear-system-1*/  
  52. #gear15{   
  53.  backgroundurl(FgFnjks.png) no-repeat 0 -993px;   
  54.  width321px;   
  55.  height321px;   
  56.  position:absolute;   
  57.  left:45px;   
  58.  top:179px;   
  59.   
  60.  -webkit-animation: rotate-back 24000ms linear infinite;   
  61.  -moz-animation: rotate-back 24000ms linear infinite;   
  62.  -ms-animation: rotate-back 24000ms linear infinite;   
  63.  animation: rotate-back 24000ms linear infinite;   
  64. }   
  65. #shadow15{   
  66.  width:306px;   
  67.  height:306px;   
  68.  -webkit-border-radius:153px;   
  69.  -moz-border-radius:153px;   
  70.  border-radius:153px;   
  71.  position:absolute;   
  72.  left:52px;   
  73.  top:186px;   
  74. }   
  75. #gear14{   
  76.  backgroundurl(FgFnjks.png) no-repeat 0 -856px;   
  77.  width87px;   
  78.  height87px;   
  79.  position:absolute;   
  80.  left:162px;   
  81.  top:296px;   
  82. }   
  83. #shadow14{   
  84.  width:70px;   
  85.  height:70px;   
  86.  -webkit-border-radius:35px;   
  87.  -moz-border-radius:35px;   
  88.  border-radius:35px;   
  89.  position:absolute;   
  90.  left:171px;   
  91.  top:304px;   
  92. }   
  93. #gear13{   
  94.  backgroundurl(FgFnjks.png) no-repeat 0 -744px;   
  95.  width62px;   
  96.  height62px;   
  97.  position:absolute;   
  98.  left:174px;   
  99.  top:309px;   
  100.   
  101.  -webkit-animation: rotate 8000ms linear infinite;   
  102.  -moz-animation: rotate 8000ms linear infinite;   
  103.  -ms-animation: rotate 8000ms linear infinite;   
  104.  animation: rotate 8000ms linear infinite;   
  105. }   
  106. #shadow13{   
  107.  width:36px;   
  108.  height:36px;   
  109.  -webkit-border-radius:18px;   
  110.  -moz-border-radius:18px;   
  111.  border-radius:18px;   
  112.  position:absolute;   
  113.  left:187px;   
  114.  top:322px;   
  115. }   
  116.   
  117. /*gear-system-2*/  
  118. #gear10{   
  119.  backgroundurl(FgFnjks.png) no-repeat 0 -184px;   
  120.  width122px;   
  121.  height122px;   
  122.  position:absolute;   
  123.  left:175px;   
  124.  top:0;   
  125.   
  126.  -webkit-animation: rotate-back 8000ms linear infinite;   
  127.  -moz-animation: rotate-back 8000ms linear infinite;   
  128.  -ms-animation: rotate-back 8000ms linear infinite;   
  129.  animation: rotate-back 8000ms linear infinite;   
  130. }   
  131. #shadow10{   
  132.  width:86px;   
  133.  height:86px;   
  134.  -webkit-border-radius:43px;   
  135.  -moz-border-radius:43px;   
  136.  border-radius:43px;   
  137.  position:absolute;   
  138.  left:193px;   
  139.  top:18px;   
  140. }   
  141. #gear3{   
  142.  backgroundurl(FgFnjks.png) no-repeat 0 -1493px;   
  143.  width85px;   
  144.  height84px;   
  145.  position:absolute;   
  146.  left:194px;   
  147.  top:19px;   
  148.   
  149.  -webkit-animation: rotate 10000ms linear infinite;   
  150.  -moz-animation: rotate 10000ms linear infinite;   
  151.  -ms-animation: rotate 10000ms linear infinite;   
  152.  animation: rotate 10000ms linear infinite;   
  153. }   
  154. #shadow3{   
  155.  width:60px;   
  156.  height:60px;   
  157.  -webkit-border-radius:30px;   
  158.  -moz-border-radius:30px;   
  159.  border-radius:30px;   
  160.  position:absolute;   
  161.  left:206px;   
  162.  top:31px;   
  163. }   
  164.   
  165. /*gear-system-3*/  
  166. #gear9{   
  167.  backgroundurl(FgFnjks.png) no-repeat -371px -280px;   
  168.  width234px;   
  169.  height234px;   
  170.  position:absolute;   
  171.  left:197px;   
  172.  top:96px;   
  173.   
  174.  -webkit-animation: rotate 12000ms linear infinite;   
  175.  -moz-animation: rotate 12000ms linear infinite;   
  176.  -ms-animation: rotate 12000ms linear infinite;   
  177.  animation: rotate 12000ms linear infinite;   
  178. }   
  179. #shadow9{   
  180.  width:200px;   
  181.  height:200px;   
  182.  -webkit-border-radius:100px;   
  183.  -moz-border-radius:100px;   
  184.  border-radius:100px;   
  185.  position:absolute;   
  186.  left:214px;   
  187.  top:113px;   
  188. }   
  189. #gear7{   
  190.  backgroundurl(FgFnjks.png) no-repeat -371px 0;   
  191.  width108px;   
  192.  height108px;   
  193.  position:absolute;   
  194.  left:260px;   
  195.  top:159px;   
  196.   
  197.  -webkit-animation: rotate-back 10000ms linear infinite;   
  198.  -moz-animation: rotate-back 10000ms linear infinite;   
  199.  -ms-animation: rotate-back 10000ms linear infinite;   
  200.  animation: rotate-back 10000ms linear infinite;   
  201. }   
  202. #shadow7{   
  203.  width:76px;   
  204.  height:76px;   
  205.  -webkit-border-radius:38px;   
  206.  -moz-border-radius: 38px;   
  207.  border-radius: 38px;   
  208.  position:absolute;   
  209.  left:276px;   
  210.  top:175px;   
  211. }   
  212.   
  213. /*gear-system-4*/  
  214. #gear6{   
  215.  backgroundurl(FgFnjks.png) no-repeat 0 -1931px;   
  216.  width134px;   
  217.  height134px;   
  218.  position:absolute;   
  219.  left:305px;   
  220.  bottombottom:212px;   
  221.   
  222.  -webkit-animation: rotate-back 10000ms linear infinite;   
  223.  -moz-animation: rotate-back 10000ms linear infinite;   
  224.  -ms-animation: rotate-back 10000ms linear infinite;   
  225.  animation: rotate-back 10000ms linear infinite;   
  226. }   
  227. #shadow6{   
  228.  width:98px;   
  229.  height:98px;   
  230.  -webkit-border-radius:49px;   
  231.  -moz-border-radius: 49px;   
  232.  border-radius: 49px;   
  233.  position:absolute;   
  234.  left:323px;   
  235.  bottombottom:230px;   
  236. }   
  237. #gear4{   
  238.  backgroundurl(FgFnjks.png) no-repeat 0 -1627px;   
  239.  width69px;   
  240.  height69px;   
  241.  position:absolute;   
  242.  left:337px;   
  243.  bottombottom:245px;   
  244.   
  245.  -webkit-animation: rotate-back 10000ms linear infinite;   
  246.  -moz-animation: rotate-back 10000ms linear infinite;   
  247.  -ms-animation: rotate-back 10000ms linear infinite;   
  248.  animation: rotate-back 10000ms linear infinite;   
  249. }   
  250.   
  251. /*gear-system-5*/  
  252. #gear12{   
  253.  backgroundurl(FgFnjks.png) no-repeat 0 -530px;   
  254.  width164px;   
  255.  height164px;   
  256.  position:absolute;   
  257.  left:208px;   
  258.  bottombottom:85px;   
  259.   
  260.  -webkit-animation: rotate 8000ms linear infinite;   
  261.  -moz-animation: rotate 8000ms linear infinite;   
  262.  -ms-animation: rotate 8000ms linear infinite;   
  263.  animation: rotate 8000ms linear infinite;   
  264. }   
  265. #shadow12{   
  266.  width:124124px;   
  267.  height:124124px;   
  268.  -webkit-border-radius:62px;   
  269.  -moz-border-radius:62px;   
  270.  border-radius:62px;   
  271.  position:absolute;   
  272.  left:225px;   
  273.  bottombottom:107px;   
  274. }   
  275. #gear11{   
  276.  backgroundurl(FgFnjks.png) no-repeat 0 -356px;   
  277.  width125px;   
  278.  height124124px;   
  279.  position:absolute;   
  280.  left:228px;   
  281.  bottombottom:105px;   
  282.   
  283.  -webkit-animation: rotate-back 10000ms linear infinite;   
  284.  -moz-animation: rotate-back 10000ms linear infinite;   
  285.  -ms-animation: rotate-back 10000ms linear infinite;   
  286.  animation: rotate-back 10000ms linear infinite;   
  287. }   
  288. #shadow11{   
  289.  width:88px;   
  290.  height:88px;   
  291.  -webkit-border-radius:44px;   
  292.  -moz-border-radius:44px;   
  293.  border-radius:44px;   
  294.  position:absolute;   
  295.  left:247px;   
  296.  bottombottom:123px;   
  297. }   
  298. #gear8{   
  299.  backgroundurl(FgFnjks.png) no-repeat -371px -158px;   
  300.  width72px;   
  301.  height72px;   
  302.  position:absolute;   
  303.  left:254px;   
  304.  bottombottom:131px;   
  305.   
  306.  -webkit-animation: rotate 6000ms linear infinite;   
  307.  -moz-animation: rotate 6000ms linear infinite;   
  308.  -ms-animation: rotate 6000ms linear infinite;   
  309.  animation: rotate 6000ms linear infinite;   
  310. }   
  311. #shadow8{   
  312.  width:42px;   
  313.  height:42px;   
  314.  -webkit-border-radius:21px;   
  315.  -moz-border-radius: 21px;   
  316.  border-radius: 21px;   
  317.  position:absolute;   
  318.  left:269px;   
  319.  bottombottom:146px;   
  320. }   
  321.   
  322. /*gear1*/  
  323. #gear1{   
  324.  backgroundurl(FgFnjks.png) no-repeat 0 0;   
  325.  width135px;   
  326.  height134px;   
  327.  position:absolute;   
  328.  left:83px;   
  329.  bottombottom:111px;   
  330.   
  331.  -webkit-animation: rotate-back 10000ms linear infinite;   
  332.  -moz-animation: rotate-back 10000ms linear infinite;   
  333.  -ms-animation: rotate-back 10000ms linear infinite;   
  334.  animation: rotate-back 10000ms linear infinite;   
  335. }   
  336. #shadow1{   
  337.  width:96px;   
  338.  height:96px;   
  339.  -webkit-border-radius:48px;   
  340.  -moz-border-radius:48px;   
  341.  border-radius:48px;   

相关文章

HTML速学教程(入门课程)
HTML速学教程(入门课程)

HTML怎么学习?HTML怎么入门?HTML在哪学?HTML怎么学才快?不用担心,这里为大家提供了HTML速学教程(入门课程),有需要的小伙伴保存下载就能学习啦!

下载

相关标签:

本站声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn

相关专题

更多
Java 桌面应用开发(JavaFX 实战)
Java 桌面应用开发(JavaFX 实战)

本专题系统讲解 Java 在桌面应用开发领域的实战应用,重点围绕 JavaFX 框架,涵盖界面布局、控件使用、事件处理、FXML、样式美化(CSS)、多线程与UI响应优化,以及桌面应用的打包与发布。通过完整示例项目,帮助学习者掌握 使用 Java 构建现代化、跨平台桌面应用程序的核心能力。

37

2026.01.14

php与html混编教程大全
php与html混编教程大全

本专题整合了php和html混编相关教程,阅读专题下面的文章了解更多详细内容。

19

2026.01.13

PHP 高性能
PHP 高性能

本专题整合了PHP高性能相关教程大全,阅读专题下面的文章了解更多详细内容。

37

2026.01.13

MySQL数据库报错常见问题及解决方法大全
MySQL数据库报错常见问题及解决方法大全

本专题整合了MySQL数据库报错常见问题及解决方法,阅读专题下面的文章了解更多详细内容。

19

2026.01.13

PHP 文件上传
PHP 文件上传

本专题整合了PHP实现文件上传相关教程,阅读专题下面的文章了解更多详细内容。

16

2026.01.13

PHP缓存策略教程大全
PHP缓存策略教程大全

本专题整合了PHP缓存相关教程,阅读专题下面的文章了解更多详细内容。

6

2026.01.13

jQuery 正则表达式相关教程
jQuery 正则表达式相关教程

本专题整合了jQuery正则表达式相关教程大全,阅读专题下面的文章了解更多详细内容。

3

2026.01.13

交互式图表和动态图表教程汇总
交互式图表和动态图表教程汇总

本专题整合了交互式图表和动态图表的相关内容,阅读专题下面的文章了解更多详细内容。

45

2026.01.13

nginx配置文件详细教程
nginx配置文件详细教程

本专题整合了nginx配置文件相关教程详细汇总,阅读专题下面的文章了解更多详细内容。

9

2026.01.13

热门下载

更多
网站特效
/
网站源码
/
网站素材
/
前端模板

精品课程

更多
相关推荐
/
热门推荐
/
最新课程
HTML5/CSS3/JavaScript/ES6入门课程
HTML5/CSS3/JavaScript/ES6入门课程

共102课时 | 6.7万人学习

HTML+CSS基础与实战
HTML+CSS基础与实战

共132课时 | 9.5万人学习

前端开发(基础+实战项目合集)
前端开发(基础+实战项目合集)

共60课时 | 3.8万人学习

关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送

Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号