Html5 舞动的雨伞
2015-01-03 11:15
190 查看
HMTL5的学习断断续续,方法不用又生疏了,昨天做的一个雨伞的Demo,先看看效果
View Code
function drawTop(ctx,fillStyle) { ctx.fillStyle = fillStyle; ctx.beginPath(); ctx.arc(0, 0, 30, 0, Math.PI, true); ctx.closePath(); ctx.fill(); } function drawGrip(ctx) { ctx.save(); ctx.fillStyle = "blue"; ctx.fillRect(-1.5, 0, 1.5, 40); ctx.beginPath(); ctx.strokeStyle = "blue"; ctx.arc(-5, 40, 4, Math.PI, Math.PI * 2, true); ctx.stroke(); ctx.closePath(); ctx.restore(); } function draw() { var ctx = document.getElementById("myCanve").getContext("2d"); ctx.translate(150, 150); for (var i = 0; i < 10; i++) { ctx.save(); ctx.rotate(Math.PI * (2 / 4 + i / 4)); ctx.translate(0, -100); //ctx.translate(70 * i, 0); drawTop(ctx, "rgb(" + (30 * i) + "," + (255 - 30 * i) + ",255)"); drawGrip(ctx); ctx.restore(); } } window.onload=function() { draw(); }
View Code
相关文章推荐
- Html5 舞动的雨伞
- 舞动你的文字 巧用html中marquee属性
- web开发之html5---html5 动画特效舞动的雨伞
- Html 解码的Java类
- [html file]标签设置用户不能自己手动输入文件路径
- HTML代码中如何去掉IE滚动条
- 1.html 1.html1.html1.html
- 去除文字里的html标签的C#方法
- "响应消息的内容类型 text/html; charset=utf-8 与绑定(text/xml; charset=utf-8)的内容类型不匹配。"问题的解决办法
- html <li> 标签后放时间格式化
- 文档附件在线预览——HYF数据格式转换软件HTML Filter
- Javascript拼接HTML字符串的方法列举及思路
- js 转译 html 文件
- IIS开启伪静态后html静态页面无法访问的解决方法
- 了解HTML表单之input元素的30个元素属性
- nano.js jqueryhtml模板
- 几乎所有的html + css 内容的编写, 都可以通过emmet来写
- HTML 多媒体
- 于鹏:利用jQuery解析本地html字符串
- HTML入门笔记25-HTML改变背景颜色