Learn 2D Vectors with JavaScript @Radu
Learn 2D Vectors with JavaScript  @Radu
Uploaded November 2022 | Updated September 2026, 2 weeks ago
We study 2D vectors by implementing an interactive tool in JavaScript. We learn about the cartesian representation and the polar representation. And vector operations like addition, subtraction, scaling, normalization and how to calculate the dot product. We use what we learn about vectors to draw vectors (an arrow) and visualize the different operations in an interactive way.

We practice these functions using JavaScript in a way that hopefully makes them more clear and useful. Check out more videos like this:

Trigonometry
youtu.be/xK3vKWMFVgw

Pythagorean Theorem
youtu.be/iqSlzYXdFzw

Interpolation (Lerp)
youtu.be/J_puRs40GhM

Segment intersection
youtu.be/fHOLQJo0FjQ

Arctangent documentation
developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/atan
developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/atan2

⭐GITHUB⭐
github.com/gniziemazity/2d-vectors

⭐SECTIONS⭐
00:00 Intro
00:58 Drawing Shapes
08:02 Magnitude
09:18 Interactivity
11:45 Direction
13:43 Polar Coordinates
17:27 Drawing Arrows
22:00 Vector Addition
30:55 Vector Subtraction
32:58 Vector Scaling and Normalization
38:02 Vector Dot Product
Learn 2D Vectors with JavaScriptJavaScript 🦌 Christmas Calendar 📅 Day 23 🎄Exploring the Missing Square Illusion | HTML Canvas Grid & Polygons TutorialCoding a Spinning Canvas App with JavaScriptCamera Input for Racing Game in JavaScript [Understanding AI - Lesson 14 / 15]Coding Sorting Visualizers with ChatGPT and JavaScriptCoding The Trolley Problem in JavaScriptJavaScript CHALLENGE! Denoise Bad Apple 🍎Understanding Data with AI (ChatGPT 3.5 and Python)⭐Creative Coding Competition⭐ (Competition Ended)🚙Self-driving Car🚗🚙🛺MANY CARS🛺🚙🚗 Easter Egg 🐰🎅How to Screenshot a Web Page with Chrome DevTools
Radu Mariescu-Istodor |

Learn 2D Vectors with JavaScript

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER