最新赞助活动温馨提示:自愿赞助服务器费用,学生和没有工作的整站资源免费下载!
头像

利用纯html5绘制出来的一款非常漂亮的时钟_html5教程技巧-H5教程

来源:http://erdangjiade.com/topic/134511.html H5程序员 2017-10-19 10:30浏览(249)

今天给大家分享一款非常漂亮的纯html5实现的时钟。整个界面都由html5绘制而成。一起看下效果图:

  实现的代码。

  htm代码:

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

  1. <p class="container">
  2. <svg width="600" height="600" class='svg-element'>
  3. <filter id="f4" x="-50%" y="-20%" width="200%" height="140%">
  4. <feOffset result="offOut" in="SourceAlpha" dx="0" dy="25" />
  5. <feGaussianBlur result="blurOut" in="offOut" stdDeviation="10" />
  6. <feBlend in="SourceGraphic" in2="blurOut" mode="normal" />
  7. </filter>
  8. <filter id="blurred-source" x="-50%" y="-20%" width="200%" height="140%">
  9. <feGaussianBlur in="color" stdDeviation="5" result="blurOut"/>
  10. </filter>
  11. <filter id="inset-shadow">
  12. <feOffset dx="0" dy="10"/> <!-- Shadow Offset -->
  13. <feGaussianBlur stdDeviation="15" result="offset-blur"/> <!-- Shadow Blur -->
  14. <feComposite operator="out" in="SourceGraphic" in2="offset-blur" result="inverse"/> <!-- Invert the drop shadow to create an inner shadow -->
  15. <feFlood flood-color="black" flood-opacity="1" result="color"/> <!-- Color & Opacity -->
  16. <feComposite operator="in" in="color" in2="inverse" result="shadow"/> <!-- Clip color inside shadow -->
  17. <feComponentTransfer in="shadow" result="shadow"> <!-- Shadow Opacity -->
  18. <feFuncA type="linear" slope="1"/>
  19. </feComponentTransfer>
  20. <feComposite operator="over" in="shadow" in2="SourceGraphic"/> <!-- Put shadow over original object -->
  21. </filter>
  22. <filter id="inset-shadow-big">
  23. <feOffset dx="0" dy="4"/> <!-- Shadow Offset -->
  24. <feGaussianBlur stdDeviation="2" result="offset-blur"/> <!-- Shadow Blur -->
  25. <feComposite operator="out" in="SourceGraphic" in2="offset-blur" result="inverse"/> <!-- Invert the drop shadow to create an inner shadow -->
  26. <feFlood flood-color="white" flood-opacity="1" result="color"/> <!-- Color & Opacity -->
  27. <feComposite operator="in" in="color" in2="inverse" result="shadow"/> <!-- Clip color inside shadow -->
  28. <feComponentTransfer in="shadow" result="shadow"> <!-- Shadow Opacity -->
  29. <feFuncA type="linear" slope="0.5"/>
  30. </feComponentTransfer>
  31. <feComposite operator="over" in="shadow" in2="SourceGraphic"/> <!-- Put shadow over original object -->
  32. </filter>
  33. <filter id="inset-shadow-big-bottom">
  34. <feOffset dx="0" dy="10"/> <!-- Shadow Offset -->
  35. <feGaussianBlur stdDeviation="2" result="offset-blur"/> <!-- Shadow Blur -->
  36. <feComposite operator="out" in="SourceGraphic" in2="offset-blur" result="inverse"/> <!-- Invert the drop shadow to create an inner shadow -->
  37. <feFlood flood-color="#FFF" flood-opacity="1" result="color"/> <!-- Color & Opacity -->
  38. <feComposite operator="in" in="color" in2="inverse" result="shadow"/> <!-- Clip color inside shadow -->
  39. <feComponentTransfer in="shadow" result="shadow"> <!-- Shadow Opacity -->
  40. <feFuncA type="linear" slope="0.5"/>
  41. </feComponentTransfer>
  42. <feComposite operator="over" in="shadow" in2="SourceGraphic" result='final-shadow-1'/> <!-- Put shadow over original object -->
  43. <feOffset dx="0" dy="-12"/> <!-- Shadow Offset -->
  44. <feGaussianBlur stdDeviation="2" result="offset-blur"/> <!-- Shadow Blur -->
  45. <feComposite operator="out" in="final-shadow-1" in2="offset-blur" result="inverse"/> <!-- Invert the drop shadow to create an inner shadow -->
  46. <feFlood flood-color="#69c39b" flood-opacity="1" result="color"/> <!-- Color & Opacity -->
  47. <feComposite operator="in" in="color" in2="inverse" result="shadow"/> <!-- Clip color inside shadow -->
  48. <feComponentTransfer in="shadow" result="shadow"> <!-- Shadow Opacity -->
  49. <feFuncA type="linear" slope="0.5"/>
  50. </feComponentTransfer>
  51. <feComposite operator="over" in="shadow" in2="final-shadow-1" result='final-shadow-2'/> <!-- Put shadow over original object -->
  52. </filter>
  53. <linearGradient id="LG"
  54. gradientTransform="rotate(90 .5 .5)">
  55. <stop id="s0" offset="0" stop-color="#d6f8e9"/>
  56. <stop id="s2" offset="1" stop-color="#9ee1c4"/>
  57. </linearGradient>
  58. <linearGradient id="LG2"
  59. gradientTransform="rotate(-90 .5 .5)">
  60. <stop id="s0" offset="0.07" stop-color="#fdfefe"/>
  61. <stop id="s1" offset="0.5" stop-color="#98e2c2"/>
  62. <stop id="s2" offset="0.8" stop-color="#79c9a7"/>
  63. <stop id="s3" offset="1" stop-color="#5fbc95"/>
  64. </linearGradient>
  65. <linearGradient id="arrow1"
  66. gradientTransform="rotate(-90 .5 .5)">
  67. <stop id="s0" offset="0" stop-color="#07594f"/>
  68. <stop id="s2" offset="1" stop-color="#01443c"/>
  69. </linearGradient>
  70. <linearGradient id="arrowRed"
  71. gradientTransform="rotate(-90 .5 .5)">
  72. <stop id="s0" offset="0" stop-color="#fd5959"/>
  73. <stop id="s2" offset="1" stop-color="#fe7c7c"/>
  74. </linearGradient>
  75. <linearGradient id="center-knob-outter"
  76. gradientTransform="rotate(90 .5 .5)">
  77. <stop id="s0" offset="0" stop-color="#fffefe"/>
  78. <stop id="s2" offset="1" stop-color="#86ecdb"/>
  79. </linearGradient>
  80. <linearGradient id="center-knob-inner"
  81. gradientTransform="rotate(90 .5 .5)">
  82. <stop id="s0" offset="0" stop-color="#a0dcd2"/>
  83. <stop id="s2" offset="1" stop-color="#dff9ef"/>
  84. </linearGradient>
  85. <g transform="translate(50, 20)">
  86. <rect x="0" y="0"
  87. width="382" height="382"
  88. fill="url(#LG)"
  89. filter="url(#inset-shadow-big-bottom)"
  90. rx="75" ry="105" />
  91. <circle cx="191" cy="191" r="155" fill="url(#LG2)"/>
  92. <circle cx="191" cy="191" r="130" fill="#53d2c5"/>
  93. <circle cx="191" cy="191" r="130" fill="#53d2c5" filter="url(#inset-shadow)" />
  94. <g width="200" height="200"
  95. transform="translate(100, 100)">
  96. <animateTransform attributeName="transform" type="translate" dur="4s"
  97. values="191,191;191,191" repeatCount="indefinite"/>
  98. <animateTransform attributeName="transform" additive="sum" type="rotate"
  99. dur="86400s" values="200, 0 0;550 0 0" repeatCount="indefinite"/>
  100. <rect x="0" y="0"
  101. width="22" height="70"
  102. fill="url(#arrow1)"
  103. fill-opacity="0.5"
  104. filter="url(#blurred-source)"
  105. rx="10" ry="10"
  106. transform="translate(-11, -15)" />
  107. </g>
  108. <g width="200" height="200"
  109. transform="translate(100, 100)">
  110. <animateTransform attributeName="transform" type="translate" dur="4s"
  111. values="191,191;191,191" repeatCount="indefinite"/>
  112. <animateTransform attributeName="transform" additive="sum" type="rotate"
  113. dur="86400s" values="200, 0 0;550 0 0" repeatCount="indefinite"/>
  114. <rect x="0" y="0"
  115. width="20" height="70"
  116. fill="url(#arrow1)"
  117. rx="10" ry="10"
  118. transform="translate(-10, -10)" />
  119. </g>
  120. <g width="200" height="200"
  121. transform="translate(100, 100)">
  122. <animateTransform attributeName="transform" type="translate" dur="4s"
  123. values="191,191;191,191" repeatCount="indefinite"/>
  124. <animateTransform attributeName="transform" additive="sum" type="rotate"
  125. dur="3600s" values="90,0 0;450 0 0" repeatCount="indefinite"/>
  126. <rect x="0" y="0"
  127. width="18" height="104"
  128. fill="url(#arrow1)"
  129. fill-opacity="0.8"
  130. filter="url(#blurred-source)"
评论0
头像

友情提示:垃圾评论一律封号 加我微信:826096331拉你进VIP群学习群

1 2