Draw rectangle by canvas

function drawRect(_x, _y, _width, _height, red, blue, green) { var canvas = document.getElementById('canvas'); if (!canvas || !canvas.getContext) { // This browser do not support canvas. return; } var context = canvas.getContext('2d'); context.fillStyle = 'rgb(' + red + ',' + blue + ',' + green + ')'; context.beginPath(); context.fillRect(_x, _y, _width, _height); }

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.