snow is now sparks

This commit is contained in:
Victor Giers
2019-06-02 00:12:51 +02:00
parent a944c9237d
commit 38bc91b8bd

View File

@@ -67,13 +67,11 @@
let mspertick = 12; let mspertick = 12;
let snowflakes = []; // array to hold snowflake objects let snowflakes = []; // array to hold snowflake objects
let startSmall = false; let startSmall = false;
let flakeR = 255;
let flakeG = 255;
let flakeB = 255;
let sw = 0; let sw = 0;
function setup() { function setup() {
canvas = createCanvas(window.innerWidth, window.innerHeight); canvas = createCanvas(window.innerWidth, window.innerHeight);
//"Hot coal" by Surukai is licensed under CC BY-NC-SA 2.0 https://www.flickr.com/photos/39113645@N08/4872013756
bgimg = loadImage("potemkin.jpg"); bgimg = loadImage("potemkin.jpg");
if(hochkant()) startSmall = true; if(hochkant()) startSmall = true;
imageMode(CENTER); imageMode(CENTER);
@@ -125,9 +123,7 @@
} else { } else {
image(bgimg, window.innerWidth/2, window.innerHeight/2,window.innerWidth,window.innerWidth/bgimg.width*bgimg.height); image(bgimg, window.innerWidth/2, window.innerHeight/2,window.innerWidth,window.innerWidth/bgimg.width*bgimg.height);
} }
stroke(255); fill(255);
strokeWeight(sw);
fill(flakeR, flakeG, flakeB);
while(millis() > runtime){ while(millis() > runtime){
@@ -173,6 +169,7 @@
} }
} }
//snowflakes //snowflakes
let t = frameCount / 60; let t = frameCount / 60;
snowflakes.push(new snowflake()); snowflakes.push(new snowflake());
@@ -192,22 +189,26 @@
function snowflake() { function snowflake() {
this.posX = 0; this.posX = 0;
this.posY = random(-50, 0); this.posY = random(window.innerHeight/4, window.innerHeight+50);
this.initialangle = random(0, 2 * PI); this.initialangle = random(0, 2 * PI);
this.size = random(2, 5); this.size = random(2, 5);
this.radius = sqrt(random(pow(width / 2, 2))); this.radius = sqrt(random(pow(width / 2, 2)));
this.r = random(0,255);
this.g = random(0,this.r);
this.b = 0;
this.update = function(time) { this.update = function(time) {
let w = 0.4; let w = 0.4;
let angle = w * time + this.initialangle; let angle = w * time + this.initialangle;
this.posX = width / 2 + this.radius * sin(angle); this.posX = width / 2 + this.radius * sin(angle);
this.posY += pow(this.size, 0.5); this.posY -= pow(this.size, 0.5);
if (this.posY > height) { if (this.posY < 0) {
let index = snowflakes.indexOf(this); let index = snowflakes.indexOf(this);
snowflakes.splice(index, 1); snowflakes.splice(index, 1);
} }
}; };
this.display = function() { this.display = function() {
fill(this.r,this.g,this.b);
ellipse(this.posX, this.posY, this.size); ellipse(this.posX, this.posY, this.size);
}; };
} }
@@ -226,13 +227,13 @@
<p> <p>
This place is going to be a hub for <b>collaborative work</b> in the fields of <b>media art</b> and <b>design</b> regarding <b>knowledge</b> and <b>social interaction</b> on the <b>internet</b>.<br> This place is going to be a hub for <b>collaborative work</b> in the fields of <b>media art</b> and <b>design</b> regarding <b>knowledge</b> and <b>social interaction</b> on the <b>internet</b>.<br>
The community is based on <b>European standards</b>, <b>the whole world is invited</b> to collaborate.<br> The community is based on <b>European standards</b>, <b>the whole world is invited</b> to collaborate.<br>
It is registered and hosted at <a href="https://www.manitu.de/" target="_blank"><b>Manitu</b></a>, a web host service based in <b>Saarland, Germany</b>.<br><br> It is registered and hosted at <a href="https://www.manitu.de/" target="_blank"><b>Manitu</b></a>, a web host service based in <b>St. Wendel, Saarland, Germany</b>.<br><br>
<b>We'd love you to get in contact with us!</b><br><br> <b>We'd love to hear from you!</b>
<h3><a href="https://discord.gg/nGDYYKE">Discord invitation</a></h3> <h3><a href="https://discord.gg/nGDYYKE">Discord invitation</a></h3><br>
</p> </p>
<p> <p>
There's a <a href="http://coal.ddns.net:3000/ember/coalmedia.eu">git</a> for this website.<br> There's a <a href="http://coal.ddns.net:3000/ember/coalmedia.eu">git-repository</a> for this website.<br>
Following links are not functioning properly yet and only here for construction purpose. Progress:
<ul> <ul>
<li><a href="chat">Chat</a></li> <li><a href="chat">Chat</a></li>
<li><a href="cloud">Cloud</a></li> <li><a href="cloud">Cloud</a></li>