Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html><head>
- <script>
- //based on http://jswidget.com/blog/2011/03/06/drawing-heart-shape/
- function onload(type) {
- drawHeart(document.getElementById('drawing'));
- }
- function drawHeart(canvas){
- var x0 = 0.5 * 10, y0 = 0.3 * 11, x1 = 0.1 * 10, y1 = 0.0 * 11, x2 = 0.0 * 10, y2 = 0.6 * 11, x3 = 0.5 * 10, y3 = 0.9 * 11, x4 = 1.0 * 10, y4 = 0.6 * 11, x5 = 0.9 * 10, y5 = 0.0 * 11;
- var ctx = canvas.getContext("2d");
- ctx.save(); ctx.beginPath();
- ctx.moveTo(x0,y0);
- ctx.bezierCurveTo(x1,y1,x2,y2,x3,y3);
- ctx.bezierCurveTo(x4,y4,x5,y5,x0,y0);
- ctx.fillStyle = '#799DC1';
- ctx.strokeStyle = '#6B8FB6';
- ctx.stroke();
- ctx.fill();
- ctx.restore();
- }
- </script>
- <title>VK</title></head><body onload="onload()">
- <center><br /><br /><br /><h1>Canvas demo<br /><br /></h1>
- <canvas style="margin:10px" id="drawing" width="100" height="500">
- </canvas>
- </center>
- </body></html>
Advertisement
Add Comment
Please, Sign In to add comment