热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

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

这篇文章主要为大家详细介绍了基于HTML5的齿轮动画特效,该齿轮动画的最大特点是它由好多个齿轮组成,这对齿轮传动的算法要求就大大提高了,而且我们并没有用JavaScript,如何实现齿轮动画,感兴趣的小伙伴们可以参考一下
这是一个基于HTML5的齿轮动画特效,我们将齿轮转动的物理学原理,转换为HTML5代码,在网页上实现了模拟齿轮转动的动画效果。该齿轮动画的最大特点是它由好多个齿轮组成,这对齿轮传动的算法要求就大大提高了,而且我们并没有用Javascript,而是纯CSS3实现的。

HTML代码

XML/HTML Code复制内容到剪贴板

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

CSS代码

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-family: sans-serif;
  40. font-size:1.2em;
  41. line-height:148%;
  42. text-shadow:rgba(0, 0, 0, 0.36) 1px 1px 0px;
  43. }
  44. .shadow{
  45. -webkit-box-shadow: 4px 7px 25px 10px rgba(43, 36, 0, 0.36);
  46. -moz-box-shadow: 4px 7px 25px 10px rgba(43, 36, 0, 0.36);
  47. box-shadow: 4px 7px 25px 10px rgba(43, 36, 0, 0.36);
  48. }
  49. /*gear-system-1*/
  50. #gear15{
  51. background: url(FgFnjks.png) no-repeat 0 -993px;
  52. width: 321px;
  53. height: 321px;
  54. position:absolute;
  55. left:45px;
  56. top:179px;
  57. -webkit-animation: rotate-back 24000ms linear infinite;
  58. -moz-animation: rotate-back 24000ms linear infinite;
  59. -ms-animation: rotate-back 24000ms linear infinite;
  60. animation: rotate-back 24000ms linear infinite;
  61. }
  62. #shadow15{
  63. width:306px;
  64. height:306px;
  65. -webkit-border-radius:153px;
  66. -moz-border-radius:153px;
  67. border-radius:153px;
  68. position:absolute;
  69. left:52px;
  70. top:186px;
  71. }
  72. #gear14{
  73. background: url(FgFnjks.png) no-repeat 0 -856px;
  74. width: 87px;
  75. height: 87px;
  76. position:absolute;
  77. left:162px;
  78. top:296px;
  79. }
  80. #shadow14{
  81. width:70px;
  82. height:70px;
  83. -webkit-border-radius:35px;
  84. -moz-border-radius:35px;
  85. border-radius:35px;
  86. position:absolute;
  87. left:171px;
  88. top:304px;
  89. }
  90. #gear13{
  91. background: url(FgFnjks.png) no-repeat 0 -744px;
  92. width: 62px;
  93. height: 62px;
  94. position:absolute;
  95. left:174px;
  96. top:309px;
  97. -webkit-animation: rotate 8000ms linear infinite;
  98. -moz-animation: rotate 8000ms linear infinite;
  99. -ms-animation: rotate 8000ms linear infinite;
  100. animation: rotate 8000ms linear infinite;
  101. }
  102. #shadow13{
  103. width:36px;
  104. height:36px;
  105. -webkit-border-radius:18px;
  106. -moz-border-radius:18px;
  107. border-radius:18px;
  108. position:absolute;
  109. left:187px;
  110. top:322px;
  111. }
  112. /*gear-system-2*/
  113. #gear10{
  114. background: url(FgFnjks.png) no-repeat 0 -184px;
  115. width: 122px;
  116. height: 122px;
  117. position:absolute;
  118. left:175px;
  119. top:0;
  120. -webkit-animation: rotate-back 8000ms linear infinite;
  121. -moz-animation: rotate-back 8000ms linear infinite;
  122. -ms-animation: rotate-back 8000ms linear infinite;
  123. animation: rotate-back 8000ms linear infinite;
  124. }
  125. #shadow10{
  126. width:86px;
  127. height:86px;
  128. -webkit-border-radius:43px;
  129. -moz-border-radius:43px;
  130. border-radius:43px;
  131. position:absolute;
  132. left:193px;
  133. top:18px;
  134. }
  135. #gear3{
  136. background: url(FgFnjks.png) no-repeat 0 -1493px;
  137. width: 85px;
  138. height: 84px;
  139. position:absolute;
  140. left:194px;
  141. top:19px;
  142. -webkit-animation: rotate 10000ms linear infinite;
  143. -moz-animation: rotate 10000ms linear infinite;
  144. -ms-animation: rotate 10000ms linear infinite;
  145. animation: rotate 10000ms linear infinite;
  146. }
  147. #shadow3{
  148. width:60px;
  149. height:60px;
  150. -webkit-border-radius:30px;
  151. -moz-border-radius:30px;
  152. border-radius:30px;
  153. position:absolute;
  154. left:206px;
  155. top:31px;
  156. }
  157. /*gear-system-3*/
  158. #gear9{
  159. background: url(FgFnjks.png) no-repeat -371px -280px;
  160. width: 234px;
  161. height: 234px;
  162. position:absolute;
  163. left:197px;
  164. top:96px;
  165. -webkit-animation: rotate 12000ms linear infinite;
  166. -moz-animation: rotate 12000ms linear infinite;
  167. -ms-animation: rotate 12000ms linear infinite;
  168. animation: rotate 12000ms linear infinite;
  169. }
  170. #shadow9{
  171. width:200px;
  172. height:200px;
  173. -webkit-border-radius:100px;
  174. -moz-border-radius:100px;
  175. border-radius:100px;
  176. position:absolute;
  177. left:214px;
  178. top:113px;
  179. }
  180. #gear7{
  181. background: url(FgFnjks.png) no-repeat -371px 0;
  182. width: 108px;
  183. height: 108px;
  184. position:absolute;
  185. left:260px;
  186. top:159px;
  187. -webkit-animation: rotate-back 10000ms linear infinite;
  188. -moz-animation: rotate-back 10000ms linear infinite;
  189. -ms-animation: rotate-back 10000ms linear infinite;
  190. animation: rotate-back 10000ms linear infinite;
  191. }
  192. #shadow7{
  193. width:76px;
  194. height:76px;
  195. -webkit-border-radius:38px;
  196. -moz-border-radius: 38px;
  197. border-radius: 38px;
  198. position:absolute;
  199. left:276px;
  200. top:175px;
  201. }
  202. /*gear-system-4*/
  203. #gear6{
  204. background: url(FgFnjks.png) no-repeat 0 -1931px;
  205. width: 134px;
  206. height: 134px;
  207. position:absolute;
  208. left:305px;
  209. bottombottom:212px;
  210. -webkit-animation: rotate-back 10000ms linear infinite;
  211. -moz-animation: rotate-back 10000ms linear infinite;
  212. -ms-animation: rotate-back 10000ms linear infinite;
  213. animation: rotate-back 10000ms linear infinite;
  214. }
  215. #shadow6{
  216. width:98px;
  217. height:98px;
  218. -webkit-border-radius:49px;
  219. -moz-border-radius: 49px;
  220. border-radius: 49px;
  221. position:absolute;
  222. left:323px;
  223. bottombottom:230px;
  224. }
  225. #gear4{
  226. background: url(FgFnjks.png) no-repeat 0 -1627px;
  227. width: 69px;
  228. height: 69px;
  229. position:absolute;
  230. left:337px;
  231. bottombottom:245px;
  232. -webkit-animation: rotate-back 10000ms linear infinite;
  233. -moz-animation: rotate-back 10000ms linear infinite;
  234. -ms-animation: rotate-back 10000ms linear infinite;
  235. animation: rotate-back 10000ms linear infinite;
  236. }
  237. /*gear-system-5*/
  238. #gear12{
  239. background: url(FgFnjks.png) no-repeat 0 -530px;
  240. width: 164px;
  241. height: 164px;
  242. position:absolute;
  243. left:208px;
  244. bottombottom:85px;
  245. -webkit-animation: rotate 8000ms linear infinite;
  246. -moz-animation: rotate 8000ms linear infinite;
  247. -ms-animation: rotate 8000ms linear infinite;
  248. animation: rotate 8000ms linear infinite;
  249. }
  250. #shadow12{
  251. width:124px;
  252. height:124px;
  253. -webkit-border-radius:62px;
  254. -moz-border-radius:62px;
  255. border-radius:62px;
  256. position:absolute;
  257. left:225px;
  258. bottombottom:107px;
  259. }
  260. #gear11{
  261. background: url(FgFnjks.png) no-repeat 0 -356px;
  262. width: 125px;
  263. height: 124px;
  264. position:absolute;
  265. left:228px;
  266. bottombottom:105px;
  267. -webkit-animation: rotate-back 10000ms linear infinite;
  268. -moz-animation: rotate-back 10000ms linear infinite;
  269. -ms-animation: rotate-back 10000ms linear infinite;
  270. animation: rotate-back 10000ms linear infinite;
  271. }
  272. #shadow11{
  273. width:88px;
  274. height:88px;
  275. -webkit-border-radius:44px;
  276. -moz-border-radius:44px;
  277. border-radius:44px;
  278. position:absolute;
  279. left:247px;
  280. bottombottom:123px;
  281. }
  282. #gear8{
  283. background: url(FgFnjks.png) no-repeat -371px -158px;
  284. width: 72px;
  285. height: 72px;
  286. position:absolute;
  287. left:254px;
  288. bottombottom:131px;
  289. -webkit-animation: rotate 6000ms linear infinite;
  290. -moz-animation: rotate 6000ms linear infinite;
  291. -ms-animation: rotate 6000ms linear infinite;
  292. animation: rotate 6000ms linear infinite;
  293. }
  294. #shadow8{
  295. width:42px;
  296. height:42px;
  297. -webkit-border-radius:21px;
  298. -moz-border-radius: 21px;
  299. border-radius: 21px;
  300. position:absolute;
  301. left:269px;
  302. bottombottom:146px;
  303. }
  304. /*gear1*/
  305. #gear1{
  306. background: url(FgFnjks.png) no-repeat 0 0;
  307. width: 135px;
  308. height: 134px;
  309. position:absolute;
  310. left:83px;
  311. bottombottom:111px;
  312. -webkit-animation: rotate-back 10000ms linear infinite;
  313. -moz-animation: rotate-back 10000ms linear infinite;
  314. -ms-animation: rotate-back 10000ms linear infinite;
  315. animation: rotate-back 10000ms linear infinite;
  316. }
  317. #shadow1{
  318. width:96px;
  319. height:96px;
  320. -webkit-border-radius:48px;
  321. -moz-border-radius:48px;
  322. border-radius:48px;
推荐阅读
  • CSS3选择器的使用方法详解,提高Web开发效率和精准度
    本文详细介绍了CSS3新增的选择器方法,包括属性选择器的使用。通过CSS3选择器,可以提高Web开发的效率和精准度,使得查找元素更加方便和快捷。同时,本文还对属性选择器的各种用法进行了详细解释,并给出了相应的代码示例。通过学习本文,读者可以更好地掌握CSS3选择器的使用方法,提升自己的Web开发能力。 ... [详细]
  • 本文讨论了Alink回归预测的不完善问题,指出目前主要针对Python做案例,对其他语言支持不足。同时介绍了pom.xml文件的基本结构和使用方法,以及Maven的相关知识。最后,对Alink回归预测的未来发展提出了期待。 ... [详细]
  • 在说Hibernate映射前,我们先来了解下对象关系映射ORM。ORM的实现思想就是将关系数据库中表的数据映射成对象,以对象的形式展现。这样开发人员就可以把对数据库的操作转化为对 ... [详细]
  • 本文介绍了在SpringBoot中集成thymeleaf前端模版的配置步骤,包括在application.properties配置文件中添加thymeleaf的配置信息,引入thymeleaf的jar包,以及创建PageController并添加index方法。 ... [详细]
  • 《数据结构》学习笔记3——串匹配算法性能评估
    本文主要讨论串匹配算法的性能评估,包括模式匹配、字符种类数量、算法复杂度等内容。通过借助C++中的头文件和库,可以实现对串的匹配操作。其中蛮力算法的复杂度为O(m*n),通过随机取出长度为m的子串作为模式P,在文本T中进行匹配,统计平均复杂度。对于成功和失败的匹配分别进行测试,分析其平均复杂度。详情请参考相关学习资源。 ... [详细]
  • 动态规划算法的基本步骤及最长递增子序列问题详解
    本文详细介绍了动态规划算法的基本步骤,包括划分阶段、选择状态、决策和状态转移方程,并以最长递增子序列问题为例进行了详细解析。动态规划算法的有效性依赖于问题本身所具有的最优子结构性质和子问题重叠性质。通过将子问题的解保存在一个表中,在以后尽可能多地利用这些子问题的解,从而提高算法的效率。 ... [详细]
  • Java验证码——kaptcha的使用配置及样式
    本文介绍了如何使用kaptcha库来实现Java验证码的配置和样式设置,包括pom.xml的依赖配置和web.xml中servlet的配置。 ... [详细]
  • 前言对于从事技术的人员来说ajax是这好东西,都会使用,而且乐于使用。但对于新手,开发一个ajax实例,还有是难度的,必竟对于他们这是新东西。leo开发一个简单的ajax实例,用的是 ... [详细]
  • Python爬取豆瓣数据实现过程解析
    这篇文章主要介绍了Python爬取豆瓣数据实现过程解析,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值, ... [详细]
  • 为什么三角形与菜单背景的颜色不同? - Why is the triangle a different colour shade to the menu background?
    Imnotunderstandingastowhythetrianglewhichappearswhenthemousehoversoverthemenuitem, ... [详细]
  • 表单提交前的最后验证:通常在表单提交前,我们必须确认用户是否都把必须填选的做了,如果没有,就不能被提交到服务器,这里我们用到表单的formname.submit()看演示,其实这个对于我们修炼道 ... [详细]
  • Scrapy 爬取图片
    1.创建Scrapy项目scrapystartprojectCrawlMeiziTuscrapygenspiderMeiziTuSpiderhttps:movie.douban.c ... [详细]
  • 之前我曾经写过一篇关于CSS的border-image属性的文章。现在几乎所有的现代浏览器都支持这个属性——除了IE10及以下IE版本。看起来这是一个非常 ... [详细]
  • Material Design Lite ,简洁惊艳的前端工具箱。
    2019独角兽企业重金招聘Python工程师标准MaterialDesignLite简介本文主要介绍MaterialDesign设计语言的HTMLCSSJS部分实现。对应每一 ... [详细]
  • Iwouldliketobeabletohaveasidebarthatcanbetoggledinandoutonabuttonpress.However ... [详细]
author-avatar
手机用户2502906263
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有