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.

52 lines
1.4 KiB

2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>Gradients</title>
  6. <link rel="stylesheet" href="../css/style.css">
  7. <!-- IE 9: display inline SVG -->
  8. <meta http-equiv="X-UA-Compatible" content="IE=9">
  9. <script type="text/javascript" src="../../dist/paper-full.js"></script>
  10. <script type="text/paperscript" canvas="canvas">
  11. var stops = [new Color(1, 1, 0, 0), 'red', 'black'];
  12. var radius = view.bounds.width * 0.4,
  13. from = new Point(view.center.x),
  14. to = from + [radius, 0];
  15. var circle = new Path.Circle({
  16. center: from,
  17. radius: radius,
  18. fillColor: {
  19. stops: stops,
  20. radial: true,
  21. origin: from,
  22. destination: to
  23. },
  24. strokeColor: 'black'
  25. });
  26. var from = view.bounds.leftCenter,
  27. to = view.bounds.bottomRight;
  28. var rect = new Path.Rectangle({
  29. from: from,
  30. to: to,
  31. fillColor: {
  32. stops: stops,
  33. radial: false,
  34. origin: from,
  35. destination: to
  36. },
  37. strokeColor: 'black'
  38. });
  39. rect.rotate(45).scale(0.7);
  40. document.body.appendChild(project.exportSVG());
  41. </script>
  42. </head>
  43. <body>
  44. <canvas id="canvas" width="300" height="600"></canvas>
  45. </body>
  46. </html>