Coffeescript Game Tutorial Draw a Circle

캔버스에 동그라미를 그리는 코드이다.

1
2
3
4
5
6
7
8
9
10
11
window.onload = ->
# get a reference to the canvas
canvas = document.getElementById("canvas")
ctx = canvas.getContext("2d")
# draw a circle
ctx.beginPath()
ctx.arc(75, 75, 10, 0, Math.PI * 2, true)
ctx.closePath()
ctx.fill()

Reference

Share Comments