Skip to content

Instantly share code, notes, and snippets.

View mrwolferinc's full-sized avatar

mrwolferinc mrwolferinc

View GitHub Profile
@skokenes
skokenes / index.js
Created September 26, 2019 14:25
SVG Path Generator for Rounded Rectangles
function createRoundedRectPath(x, y, width, height, radius) {
return (
// Move to position, offset by radius in x direction
"M" +(x + radius) + "," + y
// Draw a horizontal line to the top right curve start
+ "h" + (width - 2 * radius)
// Draw the top right corner curve
+ "a" + radius + "," + radius + " 0 0 1 " + radius + "," + radius
// Draw a vertical line to the bottom right corner
+ "v" + (height - 2 * radius)