Last active
August 29, 2015 14:10
-
-
Save khris/428c70e3f956d8d750ed to your computer and use it in GitHub Desktop.
넙죽이 머리 그리기 http://jsfiddle.net/khris/0goy12pL/
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 lang="ko"> | |
<meta charset="UTF-8"> | |
<title>넙죽이</title> | |
<script type="text/javascript"> | |
function draw() { | |
var canvas = document.getElementById('kaist_chan'); | |
var ctx = canvas.getContext('2d'); | |
ctx.fillStyle = 'rgba(22, 160, 220, 1)'; | |
ctx.beginPath(); | |
var r = 500; | |
var b = r / 100 * 99; | |
var angle = Math.acos(b/r); | |
console.log(angle); | |
ctx.arc(150, b * 2, r, -Math.PI / 2 - angle, -Math.PI / 2 + angle, false); | |
ctx.arc(150, 0, r, Math.PI / 2 - angle, Math.PI / 2 + angle, false); | |
ctx.fill(); | |
} | |
</script> | |
</head> | |
<body onload="draw()"> | |
<canvas id="kaist_chan" width="1000" height="1000"> | |
</canvas> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment