Back to Course
Intro to JS: Drawing & Animation
0% Complete
0/0 Steps
-
Introduction
Intro to programming2 Topics -
Drawing basics4 Topics
-
DrawingColoring2 Topics
-
AnimationAnimation basics3 Topics
Lesson Progress
0% Complete
Pamela shows how to program animations, using the draw() function.
Simple car motion Tutorial
Code
background</code>(151, 244, 247);<br>
noStroke();</code>
// position of the car<br> var x = 10;</code>
// draw the car body<br> fill(255, 0, 115);
<br> rect(x, 200, 100, 20);<br>
rect(x + 15, 178, 70, 40);
<code>// draw the wheels<br>
fill(77, 66, 66);<br> ellipse(x + 25, 221, 24, 24);
<br> ellipse(x + 75, 221, 24, 24);</code>