Notes: Animating an SVG File

November 29, 2019

Figuring out a simple animation using a SVG file. The purpose with flash not being useable on several devices and various security concerns with flash files that people will have this feature turned off on their browsers this is a simple, small way to replace simple flash files.

Link to CodePen Sample

SVG files are Scalable Vector Graphics, that can be created in programs like Illustrator. These instruction are from using Adobe Illustrator 2020.

WORKING NOTES:

Create the file like you would any other Illustrator file at the final size you want it.
Name the Layers where you would remember the names and understand them.
Save as an Illustrator file as you go, when you’re ready to save for the web go to File > Export to..
For this one I used these options:
Styling: Internal CSS
Font: SVG
Images: Preserve
Object IDs: Layer Names
Decimal: 2
I had unchecked Minify (this left the code longer but easier to read, see codepen sample)
I unchecked Responsive
Then I clicked ‘Show Code’ and copy and pasted that code into a basic HTML File template.

I think went through the code and did a bit of clean up. Because of how simple this SVG file is I went through and put comments above the style areas, these had names like class = .cls-5  when you go down into the SVG file you’ll see an ID that has your layer name. since I wasn’t going to do a lot I would add my code to the .cls file. Any wording such as the ‘Look a…’ had a few different styles to it, I went through and removed the extra styles between to keep it easier to manage.

I then added the keyframes to the HTML Header style area, for a big project where you’ll share keyframes or have the file on more than one page you’ll want to add the CSS to an external file.

Related Articles

Video: Din-Din with Augy

Video: Din-Din with Augy

Starting to learn how to do video editing, and to help focus the learning I needed to create some kind of project. I decided that Augy, a betta fish, would be my star, because of his star quality and he’s right here. https://www.youtube.com/watch?v=PHNwRkvYngs Keeping...

read more
Website Contact form using AWS

Website Contact form using AWS

For the next iteration of the HTML form was to set it up to send an email to the web owner using AWS. The purpose behind this is, if you have a HTML site and don’t want to purchase a monthly plan or build and maintain server software. Using AWS for this functionality...

read more
HTML with JavaScript contact form

HTML with JavaScript contact form

Link to the form: https://www.lynnamacher.com/pdf/contactForm_V1.html This is created to be basic test for an AWS contact form test. The full form when filled out will send an email through AWS to the site owner. Instead of creating the normal test form I try to...

read more

Pin It on Pinterest

Share This