Web UI for ARGUS server
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.

54 lines
1.6 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>Chain</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. // Adapted from the following Processing example:
  10. // http://processing.org/learning/topics/follow3.html
  11. // The amount of points in the path:
  12. var points = 25;
  13. // The distance between the points:
  14. var length = 35;
  15. var path = new Path({
  16. strokeColor: '#E4141B',
  17. strokeWidth: 20,
  18. strokeCap: 'round'
  19. });
  20. var start = view.center / [10, 1];
  21. for (var i = 0; i < points; i++)
  22. path.add(start + new Point(i * length, 0));
  23. function onMouseMove(event) {
  24. path.firstSegment.point = event.point;
  25. for (var i = 0; i < points - 1; i++) {
  26. var segment = path.segments[i];
  27. var nextSegment = segment.next;
  28. var vector = segment.point - nextSegment.point;
  29. vector.length = length;
  30. nextSegment.point = segment.point - vector;
  31. }
  32. path.smooth({ type: 'continuous' });
  33. }
  34. function onMouseDown(event) {
  35. path.fullySelected = true;
  36. path.strokeColor = '#e08285';
  37. }
  38. function onMouseUp(event) {
  39. path.fullySelected = false;
  40. path.strokeColor = '#e4141b';
  41. }
  42. </script>
  43. </head>
  44. <body>
  45. <canvas id="canvas" resize></canvas>
  46. </body>
  47. </html>