Permalink
Browse files

Comment canvas example 1.

  • Loading branch information...
1 parent da1f5c2 commit 52cd2c3cdedd700dad5c7ea790668bc23e016c06 @coreh coreh committed Oct 20, 2011
Showing with 9 additions and 4 deletions.
  1. +9 −4 canvas/exemplo1/js/main.js
View
@@ -1,16 +1,21 @@
-$(function() {
+$(function() {
+ // Pegamos o canvas com jQuery
var canvas = $('#c')[0]
+
+ // Pegamos o contexto de desenho 2d
var context = canvas.getContext('2d')
+ // Definimos cor e largura das linhas
context.strokeStyle = 'blue'
context.lineWidth = 3;
-
- context.fillStyle = 'white'
+ // Começamos um path novo
context.beginPath()
- context.moveTo(200, 25)
+ // Movemos o cursor e adicionamos uma linha
+ context.moveTo(200, 25)
context.lineTo(320, 375)
+ // Desenhamos o path
context.stroke()
})

0 comments on commit 52cd2c3

Please sign in to comment.