Skip to content

Instantly share code, notes, and snippets.

@rayrayzayzay
Created January 5, 2023 20:55
Show Gist options
  • Save rayrayzayzay/b97a042d3d2aeaa5948548c731a4b475 to your computer and use it in GitHub Desktop.
Save rayrayzayzay/b97a042d3d2aeaa5948548c731a4b475 to your computer and use it in GitHub Desktop.
function buildSvg(props: { children: string; dimensions: Vec2 }) {
const [width, height] = props.dimensions;
return `<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg"
width="${width}"
height="${height}"
viewBox="0 0 ${width} ${height}"
fill="none">
${props.children}
</svg>`;
}
function groupWithRotationAboutCenter(props: {
size: number;
rotation: number;
children: string;
}): string {
const centre = props.size / 2;
return `<g
transform="rotate(${props.rotation} ${centre} ${centre})"
filter="url(#shadow)">
${props.children}
</g>`;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment