搜索文档
首页
HTML/CSS
JavaScript
服务端开发
Java教程
移动端
数据库
当前位置:
首页
HTML/CSS
HTML5基础教程
HTML5 图形
源代码
清空
点击运行
<canvas id="ex2" width="500" height="150" style="border: 1px solid #cccccc;"> HTML5 Canvas not supported </canvas> <script> var canvas = document.getElementById("ex2"); var context = canvas.getContext("2d"); context.fillStyle = "#ff0000"; context.fillRect(10,10, 100, 100); context.rotate( (Math.PI / 180) * 25); //rotate 25 degrees. context.fillStyle = "#0000ff"; context.fillRect(10,10, 100, 100); </script>
运行结果