Advertisement
Guest User

Untitled

a guest
Oct 15th, 2019
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. function createRoundedRectPath(x, y, width, height, radius) {
  2. return (
  3. // Move to position, offset by radius in x direction
  4. "M" +(x + radius) + "," + y
  5. // Draw a horizontal line to the top right curve start
  6. + "h" + (width - 2 * radius)
  7. // Draw the top right corner curve
  8. + "a" + radius + "," + radius + " 0 0 1 " + radius + "," + radius
  9. // Draw a vertical line to the bottom right corner
  10. + "v" + (height - 2 * radius)
  11. // Draw the bottom right corner curve
  12. + "a" + radius + "," + radius + " 0 0 1 " + -radius + "," + radius
  13. // Draw a horizontal line to the bottom left corner
  14. + "h" + (2 * radius - width)
  15. // Draw the bottom left corner
  16. + "a" + -radius + "," + -radius + " 0 0 1 " + -radius + "," + -radius
  17. // Draw a vertical line to the top left corner
  18. + "v" + (2 * radius - height)
  19. // Draw the top left corner
  20. + "a" + radius + "," + -radius + " 0 0 1 " + radius + "," + -radius
  21. // Close the shape
  22. + "z"
  23. );
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement