-
Cheezballz
I’m trying to create custom shapes to use with the Shapes block. I use Affinity Designer, create a shape, export it as SVG, and pull it into https://jakearchibald.github.io/svgomg/ to clean it up. But my shapes either don’t ‘exist’ (they’re blank when imported, and nothing appears when using them in a shape block) or they are black rectangle that’s the right size but isn’t the actual shape.
What are the limitations and are there settings I should be aware of when exporting? Should the SVGs be a specific color? (I’m using black, will now try white)
-
George
Hi there,
There are a few key requirements for custom shapes:
The SVG markup needs to be minimal — ideally just a
<svg>wrapper with<path>element(s) inside. Complex SVG elements like<rect>,<circle>,<use>, gradients, filters, etc. can get stripped by the built-in sanitization.Make sure your SVG includes
preserveAspectRatio="none"on the<svg>element — this is what allows the shape to stretch and adapt to the container dimensions. Also ensure you have aviewBoxdefined. The built-in shapes use a viewBox width of1200with varying heights depending on the shape design.Here’s what a clean custom shape looks like:
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 360" preserveAspectRatio="none"><path d="M1200 360H0V0l1200 348z"></path></svg>For the issues you’re seeing:
- Blank/invisible shapes — most likely caused by
fill="none"in the exported SVG. If Affinity is exporting a stroke-only shape, the path exists but has no visible fill. Either remove thefill="none"attribute (the default fill is black, which GB will then override with its Color setting), or convert strokes to filled paths before exporting. - Black rectangle — this usually means the path data doesn’t match the viewBox, or complex elements were stripped during sanitization, leaving just the bounding area. Check the SVG in a text editor after SVGOMG to confirm the path
ddata looks correct.
In Affinity Designer, make sure you flatten/expand your shapes to outlines and convert any strokes to fills before exporting. In SVGOMG, enable “Prefer viewBox to width/height” and verify that
preserveAspectRatio="none"wasn’t stripped — you may need to add it back manually. - Blank/invisible shapes — most likely caused by
- You must be logged in to reply to this topic.