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
|
Rev | Line | |
---|
[28914] | 1 | <!DOCTYPE html>
|
---|
| 2 | <html>
|
---|
| 3 | <head>
|
---|
| 4 | <meta charset="UTF-8">
|
---|
| 5 | <title>Rotated Primitives</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="canvas1">
|
---|
| 9 | // This "arbitrary" shape triggered rectangles in the original code,
|
---|
| 10 | // since point2 is as far from point0 as point3 is from point1.
|
---|
| 11 | var path = new Path({
|
---|
| 12 | closed: true,
|
---|
| 13 | strokeColor: 'black'
|
---|
| 14 | });
|
---|
| 15 | path.moveTo(0, 0);
|
---|
| 16 | path.lineTo(50, 50);
|
---|
| 17 | path.lineTo(100, 100);
|
---|
| 18 | path.lineTo(-50, 150);
|
---|
| 19 | path.position += 100;
|
---|
| 20 |
|
---|
| 21 | var rect = new Path.Rectangle({
|
---|
| 22 | point: [200, 100],
|
---|
| 23 | size: [200, 300],
|
---|
| 24 | fillColor: 'red'
|
---|
| 25 | });
|
---|
| 26 | rect.rotate(40);
|
---|
| 27 |
|
---|
| 28 | var circle = new Path.Circle({
|
---|
| 29 | center: [200, 300],
|
---|
| 30 | radius: 100,
|
---|
| 31 | fillColor: 'green'
|
---|
| 32 | });
|
---|
| 33 | circle.scale(0.5, 1);
|
---|
| 34 | circle.rotate(40);
|
---|
| 35 |
|
---|
| 36 | var rect = new Path.Rectangle({
|
---|
| 37 | point: [250, 20],
|
---|
| 38 | size: [200, 300],
|
---|
| 39 | radius: [40, 20],
|
---|
| 40 | fillColor: 'yellow'
|
---|
| 41 | });
|
---|
| 42 | rect.rotate(-20);
|
---|
| 43 |
|
---|
| 44 | window._json = project.exportJSON();
|
---|
| 45 | console.log(window._json);
|
---|
| 46 | </script>
|
---|
| 47 | <script type="text/paperscript" canvas="canvas2">
|
---|
| 48 | project.importJSON(window._json);
|
---|
| 49 | </script>
|
---|
| 50 | </head>
|
---|
| 51 | <body>
|
---|
| 52 | <canvas id="canvas1" width="500" height="500"></canvas>
|
---|
| 53 | <canvas id="canvas2" width="500" height="500"></canvas>
|
---|
| 54 | </body>
|
---|
| 55 | </html> |
---|
Note:
See
TracBrowser
for help on using the repository browser.