1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
| <html> <body style="text-align:center;background-color:#1e576b"> <canvas id="logoCanvas"></canvas> </body> <script src="https://code.jquery.com/jquery-1.8.3.js"></script> <script type="text/javascript"> function drawLogo() { var w = 11; var h = 17; var border = 24; var map = [ [1,1,1,1,1,1,1,1,1,1,1], [1,0,0,0,0,0,0,0,0,0,1], [1,0,1,0,1,1,1,1,1,0,1], [1,0,1,0,0,0,0,0,1,0,1], [1,0,1,0,1,1,1,0,1,0,1], [1,0,1,0,1,0,1,0,1,0,1], [1,0,1,0,1,0,1,0,1,0,1], [1,0,1,0,0,0,0,0,1,0,1], [1,0,1,1,1,0,1,1,1,0,1], [1,0,1,0,0,0,0,0,1,0,1], [1,0,1,0,1,1,1,0,1,0,1], [1,0,1,0,1,0,0,0,1,0,1], [1,0,1,0,1,1,1,0,1,0,1], [1,0,1,0,0,0,0,0,1,0,1], [1,0,1,1,1,0,1,1,1,0,1], [1,0,0,0,0,0,0,0,0,0,1], [1,0,0,0,0,0,0,0,0,0,1] ] var canvas=document.getElementById('logoCanvas'); var fillWidth = border * w; var fillHeight = border * h; $(canvas).attr("height", fillHeight + "px"); $(canvas).attr("width", fillWidth + "px"); var ctx=canvas.getContext('2d'); ctx.clearRect(0, 0, fillWidth, fillHeight); for (var y = 0; y < h; y += 1) { for (var x = 0; x < w; x += 1) { if (map[y][x] == 0) {continue;} ctx.fillStyle='#FFF'; ctx.fillRect(x * border, y * border, border, border); } } } $(document).ready(function() { drawLogo(); }); </script> </html>
|