Udemy
    •  
    •  
    •  
    •  
    •  
    •  
    •  
    •  
Turn what you know into an opportunity and reach millions around the world.
Learn More
Your cart is empty.
Keep shopping
Make Art by Coding: Create an SVG Scene for Web Animation!
Rating: 4.5 out of 5(27 ratings)
383 students

Make Art by Coding: Create an SVG Scene for Web Animation!

Learn to create simple vector art with HTML, CSS, & JavaScript. A beginners course for web developers & digital artists.
Last updated 4/2018
English

What you'll learn

  • Recognize why you should use SVGs for web development.
  • Create SVG shapes.
  • Embed SVG on a web page.
  • Make a landscape scene entirely with code!

Course content

1 section59 lectures6h 8m total length
  • Introduction8:27

    Discover how scalable vector graphics enable infinite zoom, crisp logos, and interactive visuals by using inline SVG with CSS styling and JavaScript interactivity.

  • Introduction (cont'd)6:50

    Learn to render SVG scenes by inline SVG, image tag, or CSS background image. Create rectangles with width, height, and fill, and compare manipulation and performance across methods.

  • Creating Rectangle and Circles4:25

    Create SVG shapes by coding with rectangles and circles, defining width, height, x, y positions, circle center coordinates cx, cy, and radius, fill, stroke, and nesting or separating shapes.

  • Creating Lines3:01

    Learn to draw lines in SVG by specifying x1, y1, x2, y2, stroke width, and stroke color to connect points inside shapes, using pixels and percent positions.

  • SVG viewBox7:07

    Learn to define an SVG with explicit width and height, add shapes with fills, and use the viewBox to zoom and crop for scalable web graphics.

  • Polygon Element Part 13:33

    Explore how to use the polygon element to create shapes in SVG, defining a series of points as x,y coordinates, then fill and stroke the shape.

  • Polygon Element Part 22:26

    Add multiple polygons by specifying polygon points to form inner and outer triangles, close the polygon element, and apply a white fill with a black stroke to complete the scene.

  • Polygon Element Part 33:29

    Experiment with svg polygon points to craft multi-point shapes, adjust coordinates like 50 100 and 100 200, fill with gold and dodger blue, and stroke the edges for a web animation.

  • Polygon Element Part 44:33

    Explore drawing polygons in SVG by defining points to form a star, closing shapes, and using stroke and fill to reveal lines and structure.

  • viewBox Attributes4:57

    Master how the viewBox and viewport interact in SVG, and learn to zoom and pan by adjusting width, height, x, and y values.

  • viewBox Attributes (Cont'd)2:24

    Learn how removing explicit width and height on SVGs with a viewBox enables automatic scaling and responsiveness across window sizes, demonstrating zoom and viewport behavior.

  • Path Elements7:10
  • Path Elements (Cont'd)2:55
  • Bezier Curves Part 17:01
  • Bezier Curves Part 25:12

    Master Bezier curves by chaining control points to shape svg paths, adjusting start points, curve controls, and stroke attributes to craft smooth squiggles, lines, and simple scenes.

  • Bezier Curves Part 32:44

    Explore how to compose SVG bezier curves using the C command or the s command for smooth curves, reuse curves, and control fill color to shape complex SVG illustrations.

  • Bezier Curves Part 46:03

    Explore Bezier curves in SVG by constructing a cubic path with control points and using d, C, and s commands to build increasingly complex shapes.

  • Quadratic Bezier Curves4:01

    Explore quadratic bezier curves in svg paths using the q command with a single control point to form simple slopes, and use the t shortcut to extend curves.

  • Arcs8:57

    Explore how to create arcs in svg using the a command, with rx and ry radii, x-axis rotation, large-arc-flag and sweep-flag, shaping circular or elliptical paths.

  • Arcs (Cont'd)5:05

    Explore overlapping arc shapes in svg using path d, stroke and fill, adjusting large-arc-flag and sweep-flag to control arc direction, drawing order, and layering.

  • SVG-edit and Illustrator6:24
  • Styling Inline SVG6:42

    Style inline svg to create scalable graphics, convert text to outlines, and apply inline styling for hover effects, while loading svgs as images or backgrounds.

  • SVG in IMG tag6:42
  • SVG in Background IMG5:15

    Learn to use svg as a background image and to scale images with percent-based sizing and media queries, keeping visuals crisp on high-resolution screens with center alignment and no-repeat.

  • Modifying Inline SVG11:53

    Learn how to modify inline SVGA by adding shapes with JavaScript, including creating a red circle in the center and appending it to the SVGA using the SVGA namespace.

  • SVG with Javascript10:20
  • Adding Trees6:17
  • Creating Trees11:46
  • Creating Trees (Cont'd)3:26
  • Remove Button7:04

    Refactor code to simplify pine trees rendering, introduce a get random function, and add a remove all trees button by removing generated pines from the terrain.

  • Adding Other Tree Types15:17

    Learn to add oak trees to an svg scene by cloning elements, randomizing ellipse positions, and looping to generate multiple trees for web animation.

  • Sorting Trees8:40

    Sort oak trees by their y axis to simulate depth in an SVG scene, by collecting trees, sorting them with a comparator, and appending them to the DOM in order.

  • Sorting Trees (Cont'd)4:31
  • Refactoring Javascript6:09

    Refactor JavaScript to fix tree positioning by offsetting the y axis with each tree’s height, and simplify event handling to create and remove oak and pine trees.

  • Refactoring Javascript (Cont'd)7:03

    Refactor JavaScript by outsourcing repeated attribute assignments to a reusable function that iterates over object keys to set SVG attributes, including class and data-y-axis for oak and pine trees.

  • Saving as SVG8:52
  • Saving as SVG (Cont'd)5:48
  • Save as PNG7:21
  • Downloading Images8:04

    Refactors the image download flow by outsourcing logic into a dedicated function, detects format via data attributes, and handles PNG and SVGA downloads with a reusable downloader.

  • Refactoring Part 15:18

    Refactoring part 1 shows making a function do one thing, using callbacks or promises to wait for a draft from an svga url, then downloading the converted image.

  • Refactoring Part 26:15

    Refactor the code by encapsulating three image handling methods into a single object, including save image, convert to png, and download image, using this context for reliability.

  • Refactoring Part 33:37

    Refactor the module to be more encapsulated for reuse and export it. Attach an event listener to read name and format, initialize the saver, and save the image.

  • Main Functionality14:12
  • Main Functionality (Cont'd)3:37

    Refactor the svg scene by turning the set attributes into a method, moving the order by y axis, invoking random choices, and testing pine and oak tree movements.

  • Testing Cross-Browser Compatibility13:43

    Explore cross-browser compatibility when building an svg scene. Test in safari and firefox, diagnose issues with dom access, data attributes and capitalization, adjust viewbox sizing, and ensure reliable downloads.

  • Checking DOMcontentload2:39

    Learn how to ensure domcontentloaded events fire after the page loads by moving event listeners into the domcontentloaded handler, avoiding early access to elements and enabling reliable save functionality.

  • Styling Part 110:12

    Style a web svg scene by applying resets and box-sizing border-box, center an 80vw main container, and build responsive, blue buttons with hover and active states using flexbox.

  • Styling Part 27:13

    Calix experiments with button widths, media queries, and responsive flex layouts to keep inputs and controls aligned, wrapping content on small screens and reflowing at the 1165px breakpoint.

  • Styling Part 36:10

    Learn to refine SVG scene styling with responsive tweaks: adjust margins, set button widths with 80vw, and add media breakpoints to ensure consistent resizing across Safari and Firefox.

  • Modal for PNG Part 18:01

    Create a modal overlay to customize PNG dimensions with width and height inputs, a dark page overlay, and download or cancel actions using CSS and JavaScript.

  • Modal for PNG Part 26:27

    Build a PNG modal workflow by wiring save buttons, validating the PNG format, and toggling the modal and overlay visibility with classList, while refactoring event listeners for reliable download functionality.

  • Modal for PNG Part 36:18
  • More Javascript Refactoring6:40
  • Styling the Modal Some More9:33

    Style the modal using flexbox for layout, align items center, and consistent button and input sizing, then apply a slide-in animation with keyframes to reveal the content.

  • Adding Size Reset Button8:30

    Add a size reset button for the SVG canvas, implement a modal button class to scope reset behavior, and reset width and height using max width and max height values.

  • Outro1:29

    Finish the svg scene by enabling a cursor pointer on hover for buttons, enhancing visual feedback and interaction. Tinker with backgrounds, objects, animations, and aspect-ratio preservation.

  • ($1000 value!) Source Code0:02
  • Please leave us a rating!0:03
  • Bonus Lecture: Get 130 courses.0:09

Requirements

  • Basic understanding of HTML, CSS and JavaScript is highly helpful. To get a fast introduction, enroll in our "Kids Coding -Introduction to HTML, CSS and JavaScript" course.
  • An Internet connection to follow along in the free text editor JS Bin.
  • No SVG knowledge is required.
  • Illustrator CC or a free alternative

Description

This course was funded by a wildly successful Kickstarter.

Gain hands-on experience with coding real projects! Make vector graphics by coding in this awesome course for beginners. Scaleable Vector Graphics (SVG) is an image format that uses vectors, in contrast to other image formats like jpg, gif, or pngs, which are raster graphics. SVG is made with math. For this reason, it can scale indefinitely! This makes it great for making logos, icons, and simple designs.

Why use SVG?

  • It has good support among all modern browsers, and it's an open standard.
  • It uses smaller file sizes compared to bitmapped files.
  • You can style shapes in CSS and interact with them in JavaScript! Thus you can programmatically alter shapes for use on web pages.

Enroll today to join the Mammoth community.

Who this course is for:

  • Anyone who wants to make art for web pages using code!