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.0 KB
|
Rev | Line | |
---|
[28914] | 1 | <!DOCTYPE html>
|
---|
| 2 | <html>
|
---|
| 3 | <head>
|
---|
| 4 | <meta charset="UTF-8">
|
---|
| 5 | <title>Wave</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 | //////////////////////////////////////////////////////////////////////
|
---|
| 10 | // Values
|
---|
| 11 |
|
---|
| 12 | tool.minDistance = 10;
|
---|
| 13 |
|
---|
| 14 | var values = {
|
---|
| 15 | curviness: 0.5,
|
---|
| 16 | distance: tool.minDistance,
|
---|
| 17 | offset: 10,
|
---|
| 18 | mouseOffset: true
|
---|
| 19 | };
|
---|
| 20 |
|
---|
| 21 | //////////////////////////////////////////////////////////////////////
|
---|
| 22 | // Mouse handling
|
---|
| 23 |
|
---|
| 24 | var path;
|
---|
| 25 | function onMouseDown(event) {
|
---|
| 26 | path = new Path({
|
---|
| 27 | strokeColor: '#000000'
|
---|
| 28 | });
|
---|
| 29 | }
|
---|
| 30 |
|
---|
| 31 | var mul = 1;
|
---|
| 32 | function onMouseDrag(event) {
|
---|
| 33 | var step = event.delta.rotate(90 * mul);
|
---|
| 34 |
|
---|
| 35 | if (!values.mouseOffset)
|
---|
| 36 | step.length = values.offset;
|
---|
| 37 |
|
---|
| 38 | path.add({
|
---|
| 39 | point: event.point + step,
|
---|
| 40 | handleIn: -event.delta * values.curviness,
|
---|
| 41 | handleOut: event.delta * values.curviness
|
---|
| 42 | });
|
---|
| 43 | mul *= -1;
|
---|
| 44 | }
|
---|
| 45 | </script>
|
---|
| 46 | </head>
|
---|
| 47 | <body>
|
---|
| 48 | <canvas id="canvas" resize></canvas>
|
---|
| 49 | </body>
|
---|
| 50 | </html> |
---|
Note:
See
TracBrowser
for help on using the repository browser.