Web Interface For Lite Argus Control modules
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.

38 lines
1.2 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>Stars</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. function onMouseDown(event) {
  10. var hue = Math.random() * 360;
  11. project.currentStyle.fillColor = {
  12. hue: hue,
  13. saturation: 1,
  14. brightness: 1
  15. };
  16. }
  17. function onMouseDrag(event) {
  18. var delta = event.point - event.downPoint;
  19. var radius = delta.length;
  20. var points = 5 + Math.round(radius / 50);
  21. var path = new Path.Star({
  22. center: event.downPoint,
  23. points: points,
  24. radius1: radius / 2,
  25. radius2: radius
  26. });
  27. path.rotate(delta.angle);
  28. // Remove the path automatically before the next mouse drag
  29. // event:
  30. path.removeOnDrag();
  31. }
  32. </script>
  33. </head>
  34. <body>
  35. <canvas id="canvas" resize></canvas>
  36. </body>
  37. </html>