Intro to JS: Drawing & Animation
Learn how to use the JavaScript language and the ProcessingJS library to create fun drawings and animations.
Project Evaluations
Community Questions
All content in “Intro to JS: Drawing & Animation”
Intro to programming
If you're new here, watch our intro video and get a brief tour of our programming course. Then get coding!
Drawing basics
We'll show you the basics of programming and how to draw shapes.
Coloring
We'll show you how to color and outline your shapes!
Variables
We'll cover how to use variables to hold values, animate your drawings, and more.
Animation basics
Learn how to animate your drawings.
Interactive programs
Learn how to make programs that draw shapes based on the mouse location, like painting apps.
Bonus: Resizing with variables
Learn how to use variable expressions to resize parts of your drawing relative to other parts. (This requires a bit more math, so if you don't feel you have a good grasp of fractions yet, you can skip over this.)
Text and strings
Learn how to display text on the canvas, resize it, color it, and animate it.
Functions
Make your code more re-usable by grouping it into functions, and then make those functions accept parameters and return values.
- Functions (Scratchpad)
- Challenge: Say Your Name (Scratchpad)
- Function Parameters (Scratchpad)
- Challenge: Moles in Holes (Scratchpad)
- Function Return Values (Scratchpad)
- Challenge: Calculator (Scratchpad)
- Local and Global Variables (Scratchpad)
- Special ProcessingJS functions (Scratchpad)
- Review: Functions (Article)
- Project: Fish Tank (Scratchpad)
Logic and if Statements
Teach your program to make decisions!
- If Statements (Scratchpad)
- Challenge: Bouncy Ball (Scratchpad)
- More Mouse Interaction (Scratchpad)
- Challenge: Your First Painting App (Scratchpad)
- Booleans (Scratchpad)
- Challenge: Number Analyzer (Scratchpad)
- Logical Operators (Scratchpad)
- Challenge: Your First Button (Scratchpad)
- Challenge: Smarter Button (Scratchpad)
- If/Else - Part 1 (Scratchpad)
- Challenge: Flashy Flash Card (Scratchpad)
- If/Else - Part 2 (Scratchpad)
- Review: Logic and if Statements (Article)
- Project: Magic 8-Ball (Scratchpad)
Debugging programs
How can you figure out what's wrong with your code? Learn tips and tricks for debugging your programs.
Looping
Repeating something over-and-over? Loops are here to help!
- Intro to While Loops (Scratchpad)
- Quiz: While Loops (Exercise)
- Challenge: A Loopy Ruler (Scratchpad)
- More While Loops: Balloon Hopper (Scratchpad)
- Challenge: A Loopy Landscape (Scratchpad)
- For Loops! A New Kind of Loop (Scratchpad)
- Challenge: Lined Paper (Scratchpad)
- Nested For Loops (Scratchpad)
- Review: Looping (Article)
- Project: Build-a-House (Scratchpad)
Writing clean code
Learn how to write JavaScript code that is easy to read and understand, with good use of indentation, spacing, naming, and comments.
Arrays
Store multiple values in your variables with arrays!
Objects
Learn how to store complex data in objects.
Object-Oriented Design
How to use object-oriented concepts in JavaScript to make more re-usable code.
Becoming a better programmer
Now that you understand the basics of programming, learn techniques that will help you be more productive and write more beautiful code.