|
| 1 | +<!-- |
| 2 | +http://devhammer.net/blog/exploring-html5-canvas-part-1---introduction |
| 3 | +--> |
| 4 | +<!DOCTYPE html> |
| 5 | +<html> |
| 6 | +<head> |
| 7 | + <meta charset="utf-8" /> |
| 8 | + <title>Canvas Experimental Page</title> |
| 9 | + <style type="text/css"> |
| 10 | + html { background: transparent url('webx-bkg.png') repeat-x; margin: 0; padding: 0; } |
| 11 | + body { font-family: "Segoe UI", Tahoma, Helvetica, Arial, Sans-Serif; margin: 0; padding: 0; line-height: 150%; background: transparent url('webx-content-bkg.jpg') no-repeat center top; border: 0; outline: 0; font-size: 100%; vertical-align: baseline; color: #434343; } |
| 12 | + |
| 13 | + .container { width: 800px; margin: 0 auto 0 auto; padding: 40px 0 0 0; } |
| 14 | + </style> |
| 15 | +</head> |
| 16 | +<body> |
| 17 | + <div class="container"> |
| 18 | + <canvas id="myCanvas" width="500" height="500"> |
| 19 | + <p>Canvas is not supported by your browser.</p> |
| 20 | + </canvas> |
| 21 | + </div> |
| 22 | + <script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.7.1.min.js" type="text/javascript"></script> |
| 23 | + <script type="text/javascript"> |
| 24 | + $(document).ready(function() { |
| 25 | + var canvas = $('#myCanvas').get(0); |
| 26 | + var context = canvas.getContext("2d"); |
| 27 | + |
| 28 | + function renderContent() { |
| 29 | + context.fillRect(0, 0, canvas.width, canvas.height); |
| 30 | + |
| 31 | + var text = "Hello, Canvas!"; |
| 32 | + context.fillStyle = "#FF0000"; |
| 33 | + context.strokeStyle = "#0000FF"; |
| 34 | + context.font = "36px sans-serif"; |
| 35 | + context.strokeText(text, 10, 50); |
| 36 | + //context.fillText(text, 10, 50); |
| 37 | + } |
| 38 | + |
| 39 | + renderContent(); |
| 40 | + }); |
| 41 | + </script> |
| 42 | +</body> |
| 43 | +</html> |
| 44 | + |
0 commit comments