Skip to content

Instantly share code, notes, and snippets.

@jasongaylord
Forked from anonymous/index.html
Created February 3, 2016 05:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jasongaylord/768103ecbb937b74f4f8 to your computer and use it in GitHub Desktop.
Save jasongaylord/768103ecbb937b74f4f8 to your computer and use it in GitHub Desktop.
JS Bin canvas.getContext() Sample // source http://jsbin.com/vujasi
<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery-1.9.1.js"></script>
<meta name="description" content="canvas.getContext() Sample">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<canvas id="test" ></canvas>
<script id="jsbin-javascript">
$(document).ready(function() {
var canvas = document.getElementById('test');
var context = canvas.getContext('2d');
var x = canvas.width /2;
var y = canvas.height /2;
var radius = canvas.height /2 - 2.5;
context.beginPath();
context.arc(x, y, radius, 0, 1.2);
context.lineWidth = 5;
context.strokeStyle = 'black';
context.stroke();
});
</script>
<script id="jsbin-source-javascript" type="text/javascript">$(document).ready(function() {
var canvas = document.getElementById('test');
var context = canvas.getContext('2d');
var x = canvas.width /2;
var y = canvas.height /2;
var radius = canvas.height /2 - 2.5;
context.beginPath();
context.arc(x, y, radius, 0, 1.2);
context.lineWidth = 5;
context.strokeStyle = 'black';
context.stroke();
});</script></body>
</html>
$(document).ready(function() {
var canvas = document.getElementById('test');
var context = canvas.getContext('2d');
var x = canvas.width /2;
var y = canvas.height /2;
var radius = canvas.height /2 - 2.5;
context.beginPath();
context.arc(x, y, radius, 0, 1.2);
context.lineWidth = 5;
context.strokeStyle = 'black';
context.stroke();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment