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.

53 lines
1.6 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>Lines</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. var amount = 45;
  10. for (var i = 0; i < amount; i++) {
  11. var path = new Path({
  12. fillColor: {
  13. hue: 1,
  14. saturation: 1,
  15. brightness: Math.random()
  16. },
  17. closed: true
  18. });
  19. }
  20. var position = view.center;
  21. var mousePos = view.center;
  22. var children = project.activeLayer.children;
  23. function iterate(count) {
  24. var delta = mousePos - position;
  25. position += delta / 10;
  26. for (var i = 1; i < amount; i++) {
  27. var path = children[i];
  28. var length = Math.abs(Math.sin(i + count / 40) * 300);
  29. path.segments = [
  30. position + delta / 1.5,
  31. position + { angle: i / amount * 360, length: length },
  32. position + { angle: (i + 1) / amount * 360, length: length }
  33. ];
  34. path.fillColor.hue = count - length;
  35. }
  36. }
  37. function onFrame(event) {
  38. iterate(event.count);
  39. }
  40. function onMouseMove(event) {
  41. iterate();
  42. mousePos = event.point;
  43. }
  44. </script>
  45. </head>
  46. <body style="background:black">
  47. <canvas id="canvas" resize></canvas>
  48. </body>
  49. </html>