You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
1.3 KiB

2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>Viewbox 1</title>
  6. <link rel="stylesheet" href="../css/style.css">
  7. <script type="text/javascript" src="../../dist/paper-full.js"></script>
  8. <script type="text/paperscript" canvas="canvas">
  9. project.importSVG(document.getElementById('svg'));
  10. </script>
  11. </head>
  12. <body>
  13. <svg width="300" height="200"
  14. viewBox="100 100 1500 1000" preserveAspectRatio="none"
  15. xmlns="http://www.w3.org/2000/svg" version="1.1" id="svg">
  16. <desc>Example ViewBox - uses the viewBox
  17. attribute to automatically create an initial user coordinate
  18. system which causes the graphic to scale to fit into the
  19. viewport no matter what size the viewport is.</desc>
  20. <!-- This rectangle goes from (0,0) to (1500,1000) in user space.
  21. Because of the viewBox attribute above,
  22. the rectangle will end up filling the entire area
  23. reserved for the SVG content. -->
  24. <rect x="0" y="0" width="1500" height="1000"
  25. fill="yellow" stroke="blue" stroke-width="12" />
  26. <!-- A large, red triangle -->
  27. <path fill="red" d="M 750,100 L 250,900 L 1250,900 z"/>
  28. <!-- A text string that spans most of the viewport -->
  29. <text x="100" y="600" font-size="200" font-family="Verdana" >
  30. Stretch to fit
  31. </text>
  32. </svg>
  33. <canvas id="canvas" width="300" height="200"></canvas>
  34. </body>
  35. </html>