====== Larissa's Surprising Space: Movement ======
[[larissa-kuo| by Larissa Kuo]]
let x, y;
var stars = [];
function setup() {
createCanvas(800,600);
//Stars
for (var i = 0; i < 1000; i++) {
stars[i] = new Star();
}
// Starts in the middle
x = width / 2;
y = height / 2;
//noLoop();
}
function changingStarColor () {
for (let i = 0; i < stars.length; i++) {
if (stars[i].color == 'white')
{stars[i].color = ('blue')}
else {stars[i].color = ('')}
}
return 'hi'
}
// star class //
class Star {
constructor() {
this.x = random(width);
this.y = random(height);
this.size = random(0.25, 3);
this.t = random(TAU);
this.color = 'white'
this.scale = scale;
}
draw() {
this.t += 0.1;
var scale = this.size + sin(this.t) * 2;
fill(this.color);
noStroke();
ellipse(this.x, this.y, scale, scale);
}
}
function sTarArray (n) {
let outputArray = [];
for (let i = 100; i < n ; i++) {
outputArray.push(new sTarArray (100))
}
return outputArray
}
let mysTar = sTarArray(8);
let scale = Math.random(10)
function draw() {
{
background(0, 8, 66);
changingStarColor()
//stars
for (var i = 0; i < stars.length; i++) {
stars[i].draw();
}
let x = drawingContext.createLinearGradient(500, 250, -10, -30, -10, 90);
x.addColorStop(1, 'blue');
x.addColorStop(0.5, 'grey');
x.addColorStop(0, 'white');
drawingContext.fillStyle = x;
noStroke();
triangle(500, 250, -10, -30, -10, 90);
}
//pole
fill(133, 131, 131)
rect(340,355,4,100)
{
let x = drawingContext.createLinearGradient(10+30+300,75+300,-18+58+300,-1+20+300,100+45+300,75+300);
x.addColorStop(1, 'blue');
// g.addColorStop(0.5, 'grey');
x.addColorStop(0, 'white');
drawingContext.fillStyle = x;
noStroke();
triangle(10+30+300,75+300,-18+58+300,-1+20+300,100+45+300,75+300);
}
//moon
fill(213, 217, 204);
circle(350,700,500);
//ufo
fill(174, 172, 176);
circle(555, 230, 80);
//window
fill(29, 128, 194);
ellipse(555,225,70,50);
//bottom ufo
fill(0, 62, 120);
ellipse(556, 246, 150, 50);
//big light
fill(174, 172, 176);
ellipse(556, 260, 40, 20);
fill(255);
ellipse(556,263,20,10);
//small lights
fill(255);
circle(519,260,10);
circle(500, 255, 10);
circle(593, 260, 10);
circle(613, 254, 10);
//crater3
fill(155,158,147);
ellipse(380, 490, 60,50);
//crater2
fill(155,158,147);
ellipse(440,620,200,200) ;
//crater1
fill(155, 158, 147);
translate(-150+(width / 2), 250+height / 2);
rotate(PI / 3.0);
ellipse(0,0,96,170) ;
resetMatrix();
//radiating lights
fill(255);
stroke('grey');
strokeWeight(3);
line(450, 300, 485, 265);
//radiating
fill(255);
stroke('grey');
strokeWeight(3);
line(490, 310, 515, 270);
//radiating
fill(255);
stroke('grey');
strokeWeight(3);
line(555, 320, 555, 275);
//radiating
fill(255);
stroke('grey');
strokeWeight(3);
line(607, 320, 595, 273);
//radiating
fill(255);
stroke('grey');
strokeWeight(3);
line(655, 310, 620, 267);
noLoop()
}