-
-
Save cyio/7c697836ac99acc25055 to your computer and use it in GitHub Desktop.
用SVG绘制一个矩形 JS Bin// source http://jsbin.com/hekesa
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<canvas id="graphic"> | |
description | |
</canvas> | |
<script id="jsbin-javascript"> | |
var canvas = document.querySelector('#graphic'); | |
var dpi = window.devicePixelRadio; | |
canvas.setAttribute("width", 800*dpi); | |
canvas.setAttribute("height", 600*dpi); | |
var ctx = canvas.getContext('2d'); | |
ctx.fillStyle = "red"; | |
ctx.fillRect(40,20,100,100); | |
</script> | |
<script id="jsbin-source-javascript" type="text/javascript">var canvas = document.querySelector('#graphic'); | |
var dpi = window.devicePixelRadio; | |
canvas.setAttribute("width", 800*dpi); | |
canvas.setAttribute("height", 600*dpi); | |
var ctx = canvas.getContext('2d'); | |
ctx.fillStyle = "red"; | |
ctx.fillRect(40,20,100,100);</script></body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var canvas = document.querySelector('#graphic'); | |
var dpi = window.devicePixelRadio; | |
canvas.setAttribute("width", 800*dpi); | |
canvas.setAttribute("height", 600*dpi); | |
var ctx = canvas.getContext('2d'); | |
ctx.fillStyle = "red"; | |
ctx.fillRect(40,20,100,100); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment