Created
March 3, 2013 05:40
-
-
Save SuzanaK/5074699 to your computer and use it in GitHub Desktop.
HTML5 Canvas Minimal Excample
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
<script> | |
var canvas = document.getElementById('mycanvas'); | |
var ctx = canvas.getContext('2d'); | |
ctx.beginPath(); | |
ctx.moveTo(startX, startY); | |
ctx.lineCap = 'round'; | |
ctx.lineWidth = 3; | |
var red = (((Math.random() * 64) + 128) >> 0); | |
var green = (((Math.random() * 64) + 128) >> 0); | |
var blue = (((Math.random() * 64) + 128) >> 0); | |
ctx.strokeStyle = 'rgb(' + red + ',' + green + ',' + blue + ')'; | |
var newX = startX; | |
var newY = startY - STEP_SIZE; | |
ctx.lineTo(newX, newY); | |
ctx.stroke(); // nur am Ende | |
</script> | |
<canvas id="mycanvas" width=2800, height=2260>Your browser doesn't support the HTML5 canvas element. Please install a decent browser (e.g. Firefox)</canvas> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment