Created
October 15, 2012 07:13
-
-
Save rodrigo-x/3891164 to your computer and use it in GitHub Desktop.
snippet - triângulo canvas..
This file contains hidden or 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
// Triângulo com Canvas | |
var NS = NS || {}; | |
NS.Class = (function() { | |
var Canvas = (function() { | |
this.canvas = document.getElementById( "canvas" ); | |
this.ctx = canvas.getContext( "2d" ); | |
}); | |
Canvas.prototype.triangulo = (function() { | |
if( this.ctx ) { | |
this.ctx.fillStyle = "hsl( 353, 100%, 72% )"; | |
this.ctx.beginPath(); | |
this.ctx.moveTo( 35,50 ); | |
this.ctx.lineTo( 150,100 ); | |
this.ctx.lineTo( 150,15 ); | |
this.ctx.fill(); | |
} | |
}); | |
return new Canvas(); | |
}( NS.Class )); | |
NS.Class.triangulo(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment