
My personal choice with the infographic on the Gaslight site was to load the individual SVGs onto the page proper using partials to keep layout markup from becoming nightmarish. The SVG can be placed as either an image or included directly in your markup, and the differences are pretty immaterial. With the file prepped, it’s time for placement. In my experience, Illustrator has a way of mangling layer names involving underscores in the conversion process, so keep your eyes peeled for anything unexpected.Īlso, to take advantage of preserving the scaling aspect of SVGs, adding preserveAspectRatio="xMinYMin" to the tag to prevent any funny business. All of the tags sitting previous to the tag proper (including and tags) can be cropped out. SVG House CleaningĪfter grabbing your SVG code from the Illustrator save prompt or saving it out completely, open it up in the text editor of your choice. In the case of the sample animation, the box, cog, and flash are going to be targeted, so they’re named accordingly. When you export the file to SVG, these layer and object names will be transferred over as object ids for later targeting. Once you’re content that everything is as tidy as possible, group any objects that will be moving together. I recommend saving to be written in manually, where they’re serving as frames, and just breaking masked items down into simpler forms for others. Thusly, you owe it to yourself to make things as streamlined as possible for snappy loading, which means combining forms that are the same color and act as one is beneficial.Īdditionally, while masking within these SVGs can work, there are occasions when browsers will either disregard them entirely or transform them into Eldritch abominations.

Whether you’re crafting an illustration to play with in Adobe Illustrator, Sketch, or Inkscape, your end product will be transmuted into code. These are things I picked up while animating a few of the illustrations over on our Process page.

But while there be dragons, I have a few tips to offer as you journey out and onward into the magical, scaling and lossless land of SVG animation.

CSS animation specifications are still in working draft, which is to say, occasionally temperamental.
