

Sets the description or removes it completely when set to falseĬonverts SVG text in HTML text via the foriegn object tag reducing file bloat and allowing you to style it with CSS. Sets the title or removes it completely when set to false Use the excellent SVGO if you need better minification.Īn object of key:value strings that will be applied as attributes to the root SVG element. We don't do anything fancier than that so as to not break animations. Useful for avoiding conflicts with other SVG files for things like masks and clipPaths. NOTE: Requires using commas to separate the attributes as that makes the parsing code a lot simpler :)Īllows you to use origin=100 100 to set origins for rotating/scaling with GSAP (expands to data-svg-origin).Īppends a namespace to classes and IDs if one is provided. This is useful for fetching elements with Javascript as well as marking up elements for accessibility - see this CSS Tricks Accessible SVG article. Begin the layer name with a '#' to indicate the layer should be parsed.įor example #id=my-id, class=my-class my-other-class, role=my-role.


The following options are available.Ĭonverts layer names as defined in Illustator into attributes. Processes a single SVG and places it in the supplied destination directory. Functions process_svg(src_path, dst_path, options) All that is left to do is animate it with your tool of choice (ours is GSAP). There should now be a folder called output containing an animation.html file with your processed SVG in it. Note that the script must be called from a directory that has access to the svg files. You should see a list of processed files (or just one in this case) printed to the console if everything worked correctly. Call the script using python parallax_svg_tools/run.py. Open the command line and navigate to your project folder. Save it as animation.html.įrom svg import * compile_svg ( 'animation.svg', 'processed_animation.svg', ) inline_svg ( 'animation.html', 'output/animation.html' ) Not strictly neccessary but makes the workflow a little easier. The import statements inline the SVG inline into our HTML file so we don't have to do any copy and pasting. Call the svg animation.svg.Ĭreate a HTML file as below. Export the SVG using the File > Export > Export for Screens option with the following settings. Download the svg tools and unzip them into your project folder.Ĭreate an Illustrator file, add an element and change its layer name to say #class=my-element.
