Coffeescript Game Tutorial Add Some Color 2014-06-27 ProgrammingCoffeeScript Canvas, CoffeeScript, Programming 색깔 원을 그리는 코드이다. 123456789101112131415161718192021222324window.onload = -> # get a reference to the canvas canvas = document.getElementById("canvas") ctx = canvas.getContext("2d") ctx.fillStyle = "#00A308" ctx.beginPath() ctx.arc(220, 220, 50, 0, Math.PI*2, true) ctx.closePath() ctx.fill() ctx.fillStyle = "#FF1C0A" ctx.beginPath() ctx.arc(100, 100, 100, 0, Math.PI*2, true) ctx.closePath() ctx.fill() # the rectangle is half transparent ctx.fillStyle = "rgba(255, 255, 0, 0.5)" ctx.beginPath() ctx.rect(15, 150, 120, 120) ctx.closePath() ctx.fill() Reference Newer Coffeescript Game Tutorial Draw a Circle Older Coffeescript Game Tutorial Action