Udemy
    •  
    •  
    •  
    •  
    •  
    •  
    •  
    •  
Turn what you know into an opportunity and reach millions around the world.
Learn More
Your cart is empty.
Keep shopping
Learn Creative Coding with Vanilla JavaScript
Rating: 4.6 out of 5(113 ratings)
7,523 students

Learn Creative Coding with Vanilla JavaScript

Let's make art with code and learn object oriented programming with plain vanilla JavaScript in the process
Created byFrank Dvorak
Last updated 10/2022
English
English [Auto],

What you'll learn

  • Explore creative coding with HTML, CSS and JavaScript
  • Learn to draw with code
  • Get deep understanding of HTML canvas drawing techniques
  • Build a complete generative art project

Course content

1 section15 lectures1h 10m total length
  • Introduction & Project preview1:01

    Explore generative art as a human machine collaboration, using HTML, CSS, and vanilla JavaScript to create autonomous artwork, while you write everything from scratch, line by line, no frameworks.

  • Project setup4:05

    Set up a basic web page with a canvas and linked html, css, and javascript. Center the canvas, apply a global reset, and use the 2d context to draw.

  • Fractals & JavaScript classes2:36

    Explore how fractals form through JavaScript classes and canvas rendering, using a fractal class, particle class, and rain class to create a smooth 60 frames per second animation.

  • Drawing basic shapes4:53

    Explore object oriented programming by encapsulating data in classes, using constructors with the new keyword, and drawing a fractal on the canvas with a draw method and context.

  • Modifying shapes2:10

    Explore how to modify shapes on canvas by adjusting line width, line cap, color, and coordinates, and by controlling the line length with a class property and relative sizing.

  • Transforming shapes6:04

    Explore transforming shapes in vanilla JavaScript canvas by mastering translate, rotate, and scale to control the origin and rotation center, with practical demos of rectangles and lines.

  • Simple geometric patterns7:43

    Explore save and restore to manage canvas state, apply translate, rotate, and scale, and draw fractal lines with private methods and a public draw method.

  • How to draw fractals6:46

    Learn to draw fractals with vanilla JavaScript by building a tree-like fractal through recursion, canvas transforms, and depth control with a max level for radial symmetry.

  • Snowflake fractal6:20

    Learn to create a snowflake fractal by drawing a main branch with two symmetric branches, using recursion, scaling, and angle control to form intricate fractal shapes.

  • Making a wide range of random shapes5:08

    Explore generating a wide range of random fractal shapes on canvas using a hue-saturation-lightness color model, random color and angle, and a particle system that renders at 60 fps.

  • Particle systems and animation8:55

    Create a custom particle system with a particle class and a rain class that updates and draws 20 particles across the canvas, using an animation loop and requestAnimationFrame.

  • Drawing on multiple canvas elements2:55

    Learn to render a large fractal on one canvas while distributing particles across a second full-window canvas, convert shapes into black squares, and animate with a clear–update–redraw loop.

  • Converting canvas drawings into pixels5:29

    Convert complex fractal canvas drawings into images using data URLs, then replace 20 black rectangles with fractal images and animate randomized sizes and speeds across the canvas.

  • Experiments5:58

    Experiment with particle rotation and fractal canvas transforms by adjusting angle, translate, and save/restore; render offscreen fractals as textures and vary shapes like circles and rectangles for diverse visuals.

  • What's next?0:29

    Explore using curved lines with bezierCurveTo and quadraticCurveTo, replace lineTo and moveTo, and swap lines for images to create a wide variety of shapes on the HTML canvas.

Requirements

  • Basic knowledge of HTML, CSS and JavaScript is recommended

Description

Discover creative coding and go from drawing a single line all the way to complex randomised fractal shapes. Then turn it into a particle system to create 'fractal rain' effect. All of that with just plain HTML, CSS and vanilla JavaScript, no frameworks and no libraries. Today we deep dive into HTML canvas drawing techniques and take it step by step to make sure we understand how everything works.


In Generative art the artist creates a process which is then set into motion with some degree of autonomy resulting in a completed artwork. I like to think about it as a human machine collaboration. Today we are the artists and HTML, CSS and JavaScript is the machine. Make your unique piece of art with me and practice your front end web development skills in the process. I will explain every line of code in detail as we go along.


Class project: Fractal Rain

Skill level: Beginner to Intermediate

Topics:

1) Object oriented programming - Classes, constructors, encapsulation, abstraction

2) HTML canvas - changing state with translate, scale, rotate, drawing shapes, web animation.

3) Deep learning with vanilla JavaScript, no frameworks, no libraries


This class is not for complete beginners, but if you already know at least the basics of HTML CSS and JavaScript come join me and let me show you how to make the machine help us to create something unique and beautiful. Have fun!



Who this course is for:

  • Beginner front end web developers curious about creative coding