xxxxxxxxxx
//Code by Aaron Reuland(A_soluble_fish)
//for the #wccChallenge on theme of "show your work!(Improve some of your earliest creative coding)"
//Updated version of: https://openprocessing.org/sketch/803199
//which is the first thing I posted on openProcessing almost exactly 5 years ago.
let lightVexers=[]
let m
let wind
let texture
function setup() {
createCanvas(windowWidth, windowHeight);
texture= createGraphics(width, height)
texture.pixelDensity(1)
texture.loadPixels()
for (let x = 0; x < width; x++) {
for (let y = 0; y < height; y += floor(random(0, 3))) {
var index = (x + y * width) * 4;
let avalue = map(noise(x / 300, y / 75), -1, 1, 0, 80)
texture.pixels[index + 0] = 20;
texture.pixels[index + 1] = 20;
texture.pixels[index + 2] = 0;
texture.pixels[index + 3] = avalue;
}
}
texture.updatePixels()
m= min(width, height)
background(0, 100);
for(let i=0; i<5; i++){
lightVexers.push(new lightVexer(random(-width/6, width)))
}
}
function draw() {
clear()
background(0)
wind= noise(frameCount/50)
let launch= random()
if(launch<0.02){
lightVexers.push(new lightVexer(random(-width/6, width)))
}
for(let i=lightVexers.length-1; i>=0; i--){
lightVexers[i].show();
lightVexers[i].move();
}
noFill();
stroke(0);
strokeWeight(5);
//making star shape based on x,y coordinates with x,y var marking center
for (var y =0; y<=height+220; y +=220) {
for (var x=0; x<=width+220; x +=220) {
for (s=.10; s<1.1; s+=.2){
beginShape();
vertex(x, y - 100*s);
quadraticVertex(x, y, x -100*s, y);
quadraticVertex(x, y, x, y + 100*s);
quadraticVertex(x, y, x + 100*s, y);
quadraticVertex(x, y, x, y - 100*s);
endShape();
}
}
}
image(texture, 0, 0)
}
class lightVexer{
constructor(startX){
this.s= random(random(m/10, m*0.66))
this.pos= createVector(startX, height+this.s)
this.seed= random(1000)
}
move(){
this.pos.y-=1
this.pos.x+=wind
if(this.pos.y<-this.s){
let index= lightVexers.indexOf(this)
lightVexers.splice(index, 1)
}
}
show(){
push()
noStroke()
fill(255, 255, 240, 20);
strokeWeight(this.s*0.01)
for(let i=0; i<1.5; i+=0.05){
let xOff=map(noise(i*5, frameCount/200, this.seed), 0, 1, -this.s/6, this.s/6)
let yOff=map(noise(i*5, frameCount/200, this.seed+2), 0, 1, -this.s/4, this.s/4)
ellipse(this.pos.x+xOff, this.pos.y+yOff, this.s*sin(i+frameCount/100+this.seed))
}
pop()
}
}