Html5 舞动的雨伞
2015-01-04 09:00
204 查看
原文:Html5 舞动的雨伞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
相关文章推荐
- web开发之html5---html5 动画特效舞动的雨伞
- 『HTML5梦幻之旅』 - 舞动色彩,Canvas下实现颜色动画
- Html5 舞动的雨伞
- 『HTML5梦幻之旅』 - 舞动色彩,Canvas下实现颜色动画
- ASP.NET MVC 学习 --- 第八课(使用机器名访问网站出现html5标签不识别问题)
- html5游戏开发--"动静"结合用地图块拼成大地图 & 初探lufyl
- Cocos2d-x-html5之HelloWorld深入分析与调试
- html5中可以在手机浏览器上直接调用手机qq
- 怎样让HTML5调用手机摄像头拍照——实践就是一切
- HTML5学习_day12(3)--响应式布局
- HTML5的新特性新功能,与旧版本的HTML差异之处
- 50个最受网友欢迎的HTML5资源下载列表(珍藏版)
- JavaScript HTML5 手机网站 基本功能
- CH Round #17 舞动的夜晚
- 利用html5开发android
- HTML5要点(四)对象全整理
- HTML5学习01-基础讲解、新特性
- html5
- HTML5 For Windows Store学习(3)
- html5在 Android / IOS上不能自动播放音乐或视频