Girls Who Code at Home Meteor Catcher Part 3 - Reference Guide
Girls Who Code at Home Meteor Catcher Part 3 - Reference Guide
function setup() {
createCanvas(400, 400);
}
function draw() {
background(0, 0, 0);
noStroke();
There are many different ways you could write this. Here are a couple:
➔ Increase the value of x by a certain amount each time the program loops through.
➔ Add a small value to the xPosition variable in draw().
2
Step 3: Add motion to your meteor
JAVASCRIPT RESULT
function setup() {
createCanvas(400, 400);
}
function draw() {
background(0, 0, 0);
noStroke();
Use the subtraction arithmetic operator - instead of the addition arithmetic operator +. This would cause
the y value to decrease after each loop and change the vertical position of the meteor: