source: main/trunk/model-sites-dev/von-sparql/js/paper/examples/SVG Import/Viewbox.html@ 28914

Last change on this file since 28914 was 28914, checked in by ak19, 10 years ago

Supporting javascript libraries and bespoke code written by Steffan to support the von-sparql user interface

File size: 1.3 KB
Line 
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.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
21 <!-- This rectangle goes from (0,0) to (1500,1000) in user space.
22 Because of the viewBox attribute above,
23 the rectangle will end up filling the entire area
24 reserved for the SVG content. -->
25 <rect x="0" y="0" width="1500" height="1000"
26 fill="yellow" stroke="blue" stroke-width="12" />
27
28 <!-- A large, red triangle -->
29 <path fill="red" d="M 750,100 L 250,900 L 1250,900 z"/>
30
31 <!-- A text string that spans most of the viewport -->
32 <text x="100" y="600" font-size="200" font-family="Verdana" >
33 Stretch to fit
34 </text>
35</svg>
36 <canvas id="canvas" width="300" height="200"></canvas>
37</body>
38</html>
Note: See TracBrowser for help on using the repository browser.