======Zoey's Surprising Space: Gradation======
Made by [[Zoey-lin|Zoey Lin]]
var stars = [];
function setup() {
createCanvas(1700, 800);
noLoop()
//Stars
for (var i = 0; i < 1000; i++) {
stars[i] = new Star();
}
// Starts in the middle
x = width / 4;
y = height / 4;
}
class Space{
constructor (xposition, size,aColor, aPosition)
{
this.xposition = xposition;
this.spaceSize = size;
this.spaceColor = aColor;
this.spacePosition = aPosition;
}
draw () {
//BODY//
fill(color("beige"))
// fire //
let g = drawingContext.createLinearGradient(300,300,350,600);
g.addColorStop(0, color(219,218,253));
g.addColorStop(0.4, color(240,185,215));
g.addColorStop(0.7, color(255,213,171));
g.addColorStop(1, color(254,246,212));
drawingContext.fillStyle = g;
triangle(this.xposition+1200, 810, 100, 810, 300, 160);
fill(244,0,100);
rect(this.xposition+130, 290, 40, 100);
fill(244,96,108);
rect(this.xposition+125, 290, 50, 90);
fill(183, 232, 189);
triangle(this.xposition+180,290,320,290,349,260);
fill(225);
rect(this.xposition+120, 290, 60, 80);
fill(255, 242, 226);
circle(this.xposition+150, 320, 45);
fill(255, 242, 226);
circle(this.xposition+150, 320, 40);
fill(183, 232, 189);
triangle(this.xposition+100,370,320,310,320,370);
fill(183, 232, 189);
triangle(this.xposition+180,370,380,310,400,370);
// light //
fill(255, 255, 255, 100);
triangle(this.xposition+1200, 810, 100, 810, 300, 160);
// UFO //
fill(220, 226, 241);
ellipse(this.xposition+130,+190, 130, 40);
fill(250, 249, 222);
ellipse(this.xposition+130,+180, 190, 50);
fill(220, 226, 241);
ellipse(this.xposition+130,+165, 140, 40);
fill(253, 230, 224);
ellipse(this.xposition+130,+195, 13);
fill(253, 230, 224);
ellipse(this.xposition+90,+192, 13);
fill(253, 230, 224);
ellipse(this.xposition+170,+192, 13);
fill(253, 230, 224);
ellipse(this.xposition+210,+180, 13);
fill(253, 230, 224);
ellipse(this.xposition+50,+180, 13);
}
}
// star class //
class Star {
constructor() {
this.x = random(width);
this.y = random(height);
this.size = random(0.25, 3);
this.t = random(TAU);
}
draw() {
this.t += 0.1;
noStroke()
var scale = this.size + sin(this.t) * 4;
fill(255);
ellipse(this.x, this.y, scale, scale);
}
}
function spaceArray (n) {
let outputArray = [];
for (let i = 0; i < n ; i++) {
outputArray.push(new Space (20 + (i*300),200, 1000, 1000))
}
return outputArray
}
let mySpaces = spaceArray(0);
function draw() {
background(204, 232, 207);
//stars
for (var i = 0; i < stars.length; i++) {
stars[i].draw();
}
stroke(0)
let space2 = new Space (200,100, 1000, 1000);
space2.draw();
for(let i = 0; i < mySpaces.length ; i++){
mySpaces[i].draw();
}
}
Back To [[zoey-lin-surprising-space-movement#zoey_s_surprising_spacemovement_gradation_radiation_and_anomaly|Zoey Lin's programming page.]]