canvas-8clip.html
2015-11-23 15:09
507 查看
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> </head> <body> <canvas id="canvas" style="margin:0 auto;border:1px #ddd solid"> The current browser does not support Canvas, can replace the browser a try! </canvas> <script> window.onload = function(){ var canvas = document.getElementById('canvas'); canvas.width = 1024; canvas.height = 768; if(canvas.getContext('2d')){ var context = canvas.getContext('2d'); context.beginPath(); context.fillStyle = "#000"; context.fillRect(0,0,canvas.width,canvas.height); context.beginPath(); context.arc(500,400,150,0,Math.PI*2) context.fillStyle = "#fff"; context.fill(); context.clip(); context.fillStyle = "#058"; context.font = "bold 120px Arial"; context.textAlign = "center"; context.textBaseline = "middle"; context.fillText("Canvas",canvas.width/2,canvas.height/2) }else{ alert('当前游览器不支持Canvas,请更换游览器后再试!'); } } </script> </body> <script> /*clip 剪辑区域 context,clip */ </script> </html>
相关文章推荐
- canvas-7globleCompositeOperation2.html
- canvas-7globleCompositeOperation.html
- canvas-7global.html
- canvas-6shadow.html
- html中offsetTop、clientTop、scrollTop、offsetTop各属性介绍
- html各种数据校验
- html图标插件
- HTML编辑器
- HTML编辑器
- HTML Video 播放问题
- HTML中的行内元素和框元素详解
- html的换行问题(未解决)
- HTML总结
- html响应式布局
- html中使用sessionStorge存储数据
- html利用localStorage保存数据
- html 图片丢失
- html常用标签总结
- HTML表格边框的设置小技巧
- 一个HTML游戏总结