Skip to content

Instantly share code, notes, and snippets.

@karbassi
Created May 27, 2017 17:02
Show Gist options
  • Save karbassi/2c2d798b9fc881cf323226817ba5889a to your computer and use it in GitHub Desktop.
Save karbassi/2c2d798b9fc881cf323226817ba5889a to your computer and use it in GitHub Desktop.
var canvas = document.getElementById('drawing');
var ctx = canvas.getContext('2d');
// FACE
ctx.beginPath();
ctx.arc(250, 250, 200, 0, 2 * Math.PI);
ctx.strokeStyle = 'black';
ctx.stroke();
ctx.fillStyle = 'yellow';
ctx.fill();
// LEFT EYE
ctx.beginPath();
ctx.arc(175, 175, 25, 0, 2 * Math.PI);
ctx.fillStyle = "black";
ctx.fill();
ctx.stroke();
// RIGHT EYE
ctx.beginPath();
ctx.arc(325, 175, 25, 0, 2 * Math.PI);
ctx.fillStyle = "black";
ctx.fill();
ctx.stroke();
// SMILE
ctx.beginPath();
ctx.arc(250, 250, 150, 0, Math.PI);
ctx.fillStyle = "white";
ctx.fill();
ctx.lineTo(400, 250);
ctx.stroke();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment