Created
September 17, 2015 12:55
-
-
Save startselect/7a026db3c7a6eb04f28e to your computer and use it in GitHub Desktop.
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 lang="ja"> | |
<head> | |
<meta charset="utf-8"> | |
<title>JS_PacMan</title> | |
</head> | |
<style type="text/css"> | |
#pacman { | |
background-color: #fff; | |
} | |
</style> | |
<body> | |
<canvas id="pacman" width="300" height="250"> | |
canvasがサポートされていません。 | |
</canvas> | |
<script type="text/javascript"> | |
var cv= document.getElementById("pacman"); | |
var ctx = cv.getContext("2d"); | |
ctx.strokeStyle = "#FF0000"; | |
ctx.fillStyle = "#FF0000"; | |
ctx.beginPath(); | |
ctx.arc(100,100,50,0, 2 * Math.PI); | |
ctx.fill(); | |
ctx.strokeStyle = "#FFFFFF"; | |
ctx.fillStyle = "#FFFFFF"; | |
ctx.lineWidth = 3; | |
ctx.beginPath(); | |
ctx.arc (100, 100, 50, -30 * Math.PI/180, 30 * Math.PI/180); | |
ctx.moveTo (100, 100); | |
ctx.lineTo (100 + 50 * Math.cos (-30 * Math.PI/180), 100 + 50 * Math.sin (-30 * Math.PI/180)); | |
ctx.lineTo (100 + 50 * Math.cos (30 * Math.PI/180), 100 + 50 * Math.sin (30 * Math.PI/180)); | |
ctx.stroke(); | |
ctx.fill(); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment