SVG (Scalable Vector Graphics) is a web standard. Like HTML (Hyper-Text Markup Language), it is a markup language - "SVG is HTML for Graphics".
A markup language is just text. These lessons create SVG markup in a file with a simple text editor.
Files need to be saved with a .svg extension and without any formatting commands,
i.e. for paragraphs, bold text, etc. Any text editor that can save the file as plain text will work.
Once the file is save, open it in any browser or drag the file onto a browser window.
The following lesson plans were developed while teaching 4th-8th graders coding with SVG. The students really enjoyed working
on these lessons. They are free for any teacher, parent, or educator to use. It is a fun way to learn and/or teach coding.
Most images are drawn on a grid (graph paper on the screen) to help the student visualize what is happening as they add new shapes to
their SVG code. The grid is removed at the end of the lesson.
The SVG Lesson Plans below build on each other, so start at the beginning if you are a beginner.
View the Source
SVG, like HTML, is just text. Browsers will show you the text from the menu. Here's how:
- Chrome: View->Developer->View Source
- Firefox: Tools->Web Developer->Page Source
- Safari: Develop->Show Page Source
Note: In Safari preferences advanced setting check Show Develop Menu in menu bar
Viewing the source and seeing how someone else did something is a great way to learn.
Watch It Draw
Watching an SVG draw is another great way to learn. Copy the javascript code from
DrawShapes.js.txt
and paste it into almost any SVG image, then watch it draw. Pretty cool and works with most (not all) SVG images.