| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <title>drawImage() with SVG fragments</title> | 2 <title>createPattern() with SVG fragments</title> |
| 3 <script> | 3 <script> |
| 4 onload = function() { | 4 onload = function() { |
| 5 var context = document.getElementsByTagName('canvas')[0].getContext('2d'
); | 5 var context = document.getElementsByTagName('canvas')[0].getContext('2d'
); |
| 6 fillStyles = [ "green", "red", "blue" ]; | 6 fillStyles = [ "green", "red", "blue", "green", "red", "blue" ]; |
| 7 fillStyles.forEach(function(fillStyle, i) { | 7 fillStyles.forEach(function(fillStyle, i) { |
| 8 context.fillStyle = fillStyle; | 8 context.fillStyle = fillStyle; |
| 9 context.fillRect(i*60, i*60, 120, 120); | 9 context.fillRect(i*60, i*60, 120, 120); |
| 10 }); | 10 }); |
| 11 } | 11 } |
| 12 </script> | 12 </script> |
| 13 <canvas width="240" height="240"></canvas> | 13 <canvas width="480" height="480"></canvas> |
| OLD | NEW |