HTML5+Canvas+CSS3实现齐天大圣孙悟空腾云驾雾效果


Posted in HTML / CSS onApril 26, 2016

使用HTML5的canvas画的孙悟空,CSS3画的白云飘飘。

效果图:

HTML5+Canvas+CSS3实现齐天大圣孙悟空腾云驾雾效果

代码如下:

CSS Code复制内容到剪贴板
  1. <!doctype html>   
  2. <html>   
  3. <head>   
  4. <meta charset="utf-8">   
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">   
  6. <meta name="description" content="">   
  7. <meta name="viewport" content="width=device-width, initial-scale=1">   
  8. <title>HTML5+CSS3实现齐天大圣腾云驾雾</title>   
  9. <style type="text/css">   
  10. * {   
  11. margin: 0;   
  12. padding: 0;   
  13. border: 0;   
  14. }   
  15. html, body {   
  16. margin: 0;   
  17. }   
  18. @-webkit-keyframes STAR-MOVE {   
  19. from {   
  20. background-position: 0% 0%;   
  21. }   
  22. to {   
  23. background-position: 600% 0%;   
  24. }   
  25. }   
  26. @keyframes STAR-MOVE {   
  27. from {   
  28. background-position: 0% 0%;   
  29. }   
  30. to {   
  31. background-position: 600% 0%;   
  32. }   
  33. }   
  34. .wall {   
  35. positionabsolute;   
  36. top: 0;   
  37. left: 0;   
  38. bottombottom: 0;   
  39. rightright: 0;   
  40. }   
  41. div#background {   
  42. backgroundblack url('http://hovertree.com/texiao/html5/30/img/background.png'repeat-x 5% 0%;   
  43. background-size: cover;   
  44. -webkit-animation: STAR-MOVE 200s linear infinite;   
  45. -moz-animation: STAR-MOVE 200s linear infinite;   
  46. -ms-animation: STAR-MOVE 200s linear infinite;   
  47. animation: STAR-MOVE 200s linear infinite;   
  48. }   
  49. div#midground {   
  50. backgroundurl('http://hovertree.com/texiao/html5/30/img/midground.png')repeat 20% 0%;   
  51. z-index: 1;   
  52. -webkit-animation: STAR-MOVE 100s linear infinite;   
  53. -moz-animation: STAR-MOVE 100s linear infinite;   
  54. -ms-animation: STAR-MOVE 100s linear infinite;   
  55. animation: STAR-MOVE 100s linear infinite;   
  56. }   
  57. div#foreground {   
  58. backgroundurl('http://hovertree.com/texiao/html5/30/img/foreground.png')repeat 35% 0%;   
  59. z-index: 2;   
  60. -webkit-animation: STAR-MOVE 50s linear infinite;   
  61. -moz-animation: STAR-MOVE 50s linear infinite;   
  62. -ms-animation: STAR-MOVE 50s linear infinite;   
  63. animation: STAR-MOVE 50s linear infinite;   
  64. }#hovertreewk{position:absolute;z-index:9999;top:0px;bottombottom:0px;left:0px;rightright:0px;margin:auto;}   
  65. </style>   
  66. </head>   
  67. <body>   
  68. <div style="text-align:center;position:absolute;z-index:9;color:white"><h1>齐天大圣腾云驾雾</h1></div>   
  69. <div id="background" class="wall"></div>   
  70. <div id="midground" class="wall"></div>   
  71. <div id="foreground" class="wall"></div>   
  72. <canvas width="650" height="478" id="hovertreewk"></canvas>   
  73. <script src="http://hovertree.com/texiao/html5/30/js/hovertreewk.js"></script>   
  74. </body>   
  75. </html>  

关于HTML5+Canvas+CSS3实现齐天大圣孙悟空腾云驾雾的代码就给大家介绍完毕,希望对大家有所帮助!

HTML / CSS 相关文章推荐
纯CSS绘制漂亮的圆形图案效果
May 07 HTML / CSS
浅析css3中matrix函数的使用
Jun 06 HTML / CSS
10分钟理解CSS3 FlexBox弹性布局
Dec 20 HTML / CSS
html5利用canvas绘画二级树形结构图的示例
Sep 27 HTML / CSS
HTML5 预加载让页面得以快速呈现
Aug 13 HTML / CSS
HTML5 Convas APIs方法详解
Apr 24 HTML / CSS
详解使用HTML5 Canvas创建动态粒子网格动画
Dec 14 HTML / CSS
详解三种方式实现平滑滚动页面到顶部的功能
Apr 23 HTML / CSS
canvas如何实现多张图片编辑的图片编辑器
Mar 10 HTML / CSS
CSS filter 有什么神奇用途
May 25 HTML / CSS
HTML中的表格元素介绍
Feb 28 HTML / CSS
box-shadow单边阴影的实现
May 21 HTML / CSS
HTML5标签嵌套规则详解【必看】
Apr 26 #HTML / CSS
HTML 5.1来了 9月份正式发布 更新内容预览
Apr 26 #HTML / CSS
HTML5本地数据库基础操作详解
Apr 26 #HTML / CSS
HTML5移动端手机网站开发流程
Apr 25 #HTML / CSS
基于html5绘制圆形多角图案
Apr 21 #HTML / CSS
浅析border-radius如何兼容IE
Apr 19 #HTML / CSS
如何利用input事件来监听移动端的输入
Apr 15 #HTML / CSS
You might like
PHP观察者模式原理与简单实现方法示例
2017/08/25 PHP
用jquery写的一个万年历(自写)
2014/01/20 Javascript
JQuery性能优化的几点建议
2014/05/14 Javascript
加载列表时jquery获取ul中第一个li的属性
2014/11/02 Javascript
angularjs基础教程
2014/12/25 Javascript
javascript实现鼠标拖动改变层大小的方法
2015/04/30 Javascript
简单实现js放大镜效果
2017/07/24 Javascript
新手快速入门JavaScript装饰者模式与AOP
2019/06/24 Javascript
element-ui中Table表格省市区合并单元格的方法实现
2019/08/07 Javascript
基于javascript实现贪吃蛇经典小游戏
2020/04/10 Javascript
jQuery实现的上拉刷新功能组件示例
2020/05/01 jQuery
详解template标签用法(含vue中的用法总结)
2021/01/12 Vue.js
python实现将文本转换成语音的方法
2015/05/28 Python
Linux下为不同版本python安装第三方库
2016/08/31 Python
使用Python将数组的元素导出到变量中(unpacking)
2016/10/27 Python
python验证码识别实例代码
2018/02/03 Python
Python面向对象之类和对象属性的增删改查操作示例
2018/12/14 Python
Python Pandas 获取列匹配特定值的行的索引问题
2019/07/01 Python
解析Python3中的Import
2019/10/13 Python
使用django和vue进行数据交互的方法步骤
2019/11/11 Python
python中的数组赋值与拷贝的区别详解
2019/11/26 Python
Python使用socketServer包搭建简易服务器过程详解
2020/06/12 Python
Python绘制组合图的示例
2020/09/18 Python
详解CSS3中的box-sizing(content-box与border-box)
2019/04/19 HTML / CSS
Kickers鞋英国官网:男士、女士和儿童鞋
2021/03/08 全球购物
事业单位个人应聘自荐信
2013/09/21 职场文书
秋季婚礼证婚词
2014/01/11 职场文书
亲子读书活动方案
2014/02/22 职场文书
人力资源部经理岗位职责规定
2014/02/23 职场文书
绿化工程实施方案
2014/03/17 职场文书
优秀家长自荐材料
2014/08/26 职场文书
导游词400字
2015/02/13 职场文书
学校就业保障协议书
2019/06/24 职场文书
100句拼搏进取的名言警句,值得一读!
2019/10/07 职场文书
用Python实现Newton插值法
2021/04/17 Python
Golang实现可重入锁的示例代码
2022/05/25 Golang