25 Snippets That Demonstrate the Power of Canvas & SVG

These CSS and JavaScript snippets demonstrate some of the amazing effects you can create using SVGs and canvas elements.

Web browsers are still working towards a unified relationship with web standards. This means developers have support for some CSS prefixes but still have to wait patiently for the full benefits of other techniques like SVG animation. While vectors have become much more accepted in recent years, vector animations & effects still languish through the realm of maladapted support.

The more advanced trends appear where rubber meets the road. Where development techniques merge with the possibilities of current web browsers. The following CSS/JS snippets demonstrate some of the amazing effects you can create using SVGs & canvas elements. These techniques often work best in more creative or experimental layouts with a broad range of tech-savvy visitors.

Interactive SVG Workspace By Belle Epoque

Custom SVG elements can be combined together into an <svg> tag to make hard-coded illustrations for the web. This example from Belle Epoque is a fully interactive studio workspace.

Try clicking on the bicycle, the light switch, or even drawing the shades. Each interaction is managed through JavaScript but the illustration is 100% HTML/CSS code.

Sparkle Trail By Jack Rugile

Here’s an interested re-creation of a Dribbble shot made by Ramiro Galan. The trailing sparkle effect is notably harmonious with the original shot, but the coolest part is how everything was recreated using Canvas and JavaScript.

Icon Hover Glow By Chris Colouryum

One of the simplest things you can do with SVG is a toggle animation. This lightbulb icon fits the metaphor nicely with an on/off animation style. Also note how the JS code is only for cross-browser support – the animation itself relies solely on HTML and CSS3.

Rotating Petals By Bailh

Abstract design ideas tend to be the most interesting but the least useful in real-world situations. I still really dig this paper pattern built on Snap.svg. It offers a weird yet significant learning curve with SVG elements like ellipse and linearGradient.

Simple Animated Icons By Simurai

CSS masking with SVGs can be very similar to Photoshop if you learn to do it right. This code snippet runs on custom SVG files with background gradients. The only downside is that CSS masks have poor browser support – but hopefully this will improve in time.

Elastic Material Design Sidebar By Nikolay Talanov

Mobile apps are renowned for their touch/tap effects that websites haven’t needed until touchscreen Internet. With SVGs you can create a touch/drag animation right in the browser, and this elastic menu plays the part nicely.

Vector Map Point By Adam Girton

Just a simple vector icon map of California with a beacon pinpointing home. California’s shape is actually built using SVG coordinates in HTML while the marker is pure CSS animation.

Responsive Graph By Andrew Weeks

Regular images can be made responsive but they often resize based on fixed dimensions. This graph can be stretchy, and even reposition data points to fit better on a small X/Y axis. Very cool use of SVGs for the responsive web.

CSS3 + SVG Animation By lionelB

A simple little airplane floating amongst the clouds. Not exactly useful for every web project but still quite inspiring to see what’s possible using only SVG & CSS.

Glossy Shine Effect By Vincent De Oliveira

This logo effect relies on a PNG image for the graphic but uses SVG/CSS masking for the shine. No JavaScript or external libraries needed – just pure CSS animation which is damn impressive.

Burger Menu Animation By Kyle Henwood

This is perhaps my favorite 3-bar hamburger icon animation effect. It uses two different SVGs with internal paths manipulated by JS and CSS classes.

Browser support is still a bit wonky but it could make a fine staple animation for future website interfaces.

SVG Typography Experiment By Chris Wright

A little experiment that shows how modern Webkit/IE browser engines can actually curve text along an SVG path. For all intents and purposes you’d be better off using a static image in any real project. But this is still very cool and worth considering for abstract typographic ideas.

Fullscreen Navigation By Anas Ashraf

Fullscreen dropdown menus can be found on many websites, often agencies or large creative studios. This particular code snippet uses a custom SVG for the 3-bar icon attached with a sweet animated effect.

Moving Mask By John Grishin

Masking is a tricky subject with spotty support but this example doesn’t use the typical CSS properties. Instead John uses JavaScript to manipulate paths based on which areas are touching within the diamond shape. Quite unique and fun to play with, too!

Canvas Circle Loader By Jack Rugile

Here’s a weird loader animation that resembles a polygraph mixed with a submarine radar. The content is housed inside a canvas element with JavaScript doing all the heavy lifting.

If you’re looking to get started with CSS animation, Tuts+ have some handy courses that will get you going in no time: CSS Animation in the Real World and Scroll-Based CSS Animations.
They also have a great course for getting started with SVG for web design.

Depth of Field Effect By Vaughan Curd

Photographs can be manipulated in Photoshop but never dynamically for the web. This depth of field effect uses everything from SVG filters to JavaScript manipulation with an HTML <map> tag.

Dancing Robot By Val Head

It’s the simple things in life that bring joy and this dancing robot is full of jubilation. Each limb is built with a different SVG file which animates based on a CSS class.

Social Sharing Bar By Max West

3D browser effects are becoming more popular with a growing number of 3D JavaScript libraries. This social sharing bar uses an SVG with CSS3 perspective transforms. Quick, clean, and quite congenial.

Animated Map Directions By Max Boll

I’ve never seen this technique in a real website but it could be super helpful to delineate office locations or to create dynamic driving directions. The animated line is built using SVG coordinates which could be updated dynamically via JavaScript.

LCD Clock By Christian Hanvey

Believe it or not this entire clock was built using SVG elements. The polygon element is used since most of the shapes require 3 or more sides. Plus the time is surprisingly accurate based on JavaScript date/time methods.

CSS/JS/Canvas Night Scene By Jack Rugile

Parallax design goes hand-in-hand with SVGs and canvas elements. This minimalist scene was built using a few SVG icons surrounded by an outer canvas. It’s made to stretch and fit into enormous window sizes because the patterns are all vector-based.

SVG Letter Sprite By nahuelsotelo

Just another typographic experiment relying on SVGs for effects and scalability. The first letter of each word is contained inside an SVG sprite sheet. It requires very little code and runs surprisingly smooth in most browsers.

Shooting Plusses By Jack Rugile

Minimalist effects are common for testing simple features like these spouting plus signs. This requires only a single canvas element with ~100 lines of JavaScript. Everything from the plusses to the water hose animation is controlled via JavaScript.

UI Demo Animation By Lloyd Wheeler

Landing pages often rely on videos to describe how a product works. This SVG-based UI animation could be a wonderful alternative if you prefer minimalist design. The monitor icon is made with base64 SVG/XML code and animated with CSS3, but you could achieve the same effect with SVG files and JavaScript animation too.

SVG Weather Icons By Noah Blon

I can’t help but marvel at the beauty of this weather iconset. It’s based off Adam Whitcroft’s Climacons but each icon includes an extra CSS animation. The HTML is rather lengthy since each icon is hard-coded with XML/SVG but there’s still a lot to be learned by studying the techniques used in this snippet.


Those who aren’t familiar with vectors on the web can learn a lot by dissecting these code samples. SVGs have been fully adopted by all browsers and support for SVG manipulation is growing steadily. It’s my hope that these snippets will both teach newcomers and inspire seasoned veterans to learn more and build more SVG visual effects for the web.

If you would like to view some code snippets for animating CSS, check out this post: A Collection of Pure CSS Animation Snippets & Demos.

About the Author Jake Rocheleau

Jake is a passionate writer & digital designer frequently researching the latest trends in UI/UX design and user behaviors. You can find work samples on his portfolio and follow his tweets @jakerocheleau.