/*Austin Treu
atreu@andrew.cmu.edu
Section B
Project-10*/
var xStart = 0, buzz, buzzY;
var buzzLink = 'https://i.imgur.com/KfTOvVY.png?1';
function preload(){
buzz = loadImage(buzzLink);
}
function setup() {
createCanvas(480, 480);
background(0,0,40);
buzzY = height/2;
}
function draw() {
background(0,0,40);
//make the stars
for(var x = xStart; x < width+xStart; x+=10){
var y1 = noise(x)*height;
var y2 = noise(x+10)*height/4;
var y3 = noise(x+10)*3*height/4;
var y4 = noise(x+10)*height*2;
stroke(255);
point(x-xStart, y1);
point(x-xStart, y2);
point(x-xStart, y3);
point(x-xStart, y4);
}
//buzz rocketing through space
imageMode(CENTER);
image(buzz, width/5, (15*noise((width/5+xStart)))+height/2);
/*create and move planets
var py = int(random(height));
var pSize = int(random(10,100));
var r = int(random(0, 255));
var g = int(random(0, 255));
var b = int(random(0, 255));
var pCol = 'rgb('+r+','+g+','+b+')';
noStroke();
fill(pCol);
ellipse(width+100-xStart,py,pSize,pSize);*/
//move screen
xStart+=10;
}
I went into this project with an empty mind, searching for an idea. I opened up a new tab and went to a newsfeed and saw a headline about space. This took me in the direction I ultimately went. The stars were not too difficult to add, I just had to figure out how to utilize noise() to achieve what I wanted. After some trial and error, I decided that I wanted more on the screen, so I set out to find an image of a spaceship. That led me to a picture of an astronaut, which led me to the picture of Buzz Lightyear that I used. I intended to include some planets, but was unable to complete that, so this project is entitled ‘Buzz Flies Through Deep Space’.