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.

28 lines
932 B

2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>Circles</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 onMouseDrag(event) {
  10. // The radius is the distance between the position
  11. // where the user clicked and the current position
  12. // of the mouse.
  13. var path = new Path.Circle({
  14. center: event.downPoint,
  15. radius: (event.downPoint - event.point).length,
  16. fillColor: 'white',
  17. strokeColor: 'black'
  18. });
  19. // Remove this path on the next drag event:
  20. path.removeOnDrag();
  21. };
  22. </script>
  23. </head>
  24. <body>
  25. <canvas id="canvas" resize></canvas>
  26. </body>
  27. </html>