xxxxxxxxxx
148
let t,s;
var seed = Math.random() * 15283;
let waternum;
let coffeenum;
let colors=['#0072e4','#ddf812','#0072e4','#0072e4','#0072e4','#0072e4','#0072e4']
let date=['MON',' TUE','WED',' THU','FRI',' SAT','SUN']
let Datapoint=[];
function preload(){
dateFont=loadFont('23165521968.ttf');
}
function setup() {
createCanvas(800, 800 ,WEBGL);
t=0;
s=0;
textFont(dateFont,13);
waternum = 8;
coffeenum = 3;
}
function draw() {
background('#000000');
randomSeed(seed);
push();
dateBar();
pop();
//
push();
if (mouseX>0&&mouseX<85&&mouseY>553&&mouseY<height){
waternum = 20;
}
if (mouseX>85&&mouseX<170&&mouseY>553&&mouseY<height){
waternum = 2;
}
if (mouseX>170&&mouseX<255&&mouseY>553&&mouseY<height){
waternum = 10;
}
if (mouseX>255&&mouseX<340&&mouseY>553&&mouseY<height){
waternum = 8;
}
if (mouseX>340&&mouseX<425&&mouseY>553&&mouseY<height){
waternum = 3;
}
if (mouseX>425&&mouseX<510&&mouseY>553&&mouseY<height){
waternum = 5;
}
if (mouseX>510&&mouseX<width&&mouseY>553&&mouseY<height){
waternum =7;
}
if(mouseY<533){
waternum=50;
}
pop();
push();
for (let i = 0; i < waternum; i++) {
let a = (TAU / waternum) * i;
let x = 500 * sin(a + t) / random(5, 3) / 1.0;
let y = 450 * cos(a + t) / random(3, 5) / 1.0;
Datapoint[i] = createVector(x, y);
}
pop();
//
push();
for (let i=0; i<7;i++){
for(let j=0;j<1;j++){
rotateX(random(TAU)+sin(-t) / 5 + i );
rotateY(random(TAU)+cos(t) / 5 + i );
rotateZ(random(TAU)+sin(-t) / 5 + i );
noStroke();
//fill(colors[i]);
fill('##0072e4');
for(let l=0; l<8;l+=8){
let d=180;
push();
rotateX( random(TAU)+sin(t));
rotateY(random(TAU)+cos(-t));
rotateZ( random(TAU)+2 * sin(2*t) );
torus(50+d*i*0.15,0.5+0.15*i,100,100);
pop();0
}
}
}
pop();
push();
for (let i = 0; i < waternum; i++) {
for(let j=0;j<1;j++){
rotateX(random(TAU)+sin(-t) / 5 + i );
rotateY(random(TAU)+cos(t) / 5 + i );
rotateZ(random(TAU)+sin(-t) / 5 + i );
noStroke();
}
//let d = (1.5 + sin(t)) * random(radius / 2, radius / 4);
let d = random(0.75*width)
let x_plus = 0.5 * random(-d, d) / 1;
let y_plus = 0.5 * random(-d, d) / 1;
let z_plus = 0.5 * random(-d, d) / 1;
stroke('#f2eee9');
strokeWeight(0.15);
noFill();
push();
translate(Datapoint[i].x , Datapoint[i].y , z_plus);
rotateX(random(TAU)+s);
rotateY(random(-TAU)+s);
rotateZ(random(PI)+s);
sphere(random(8,15));
pop();
}
pop();
// t+=0.003;
t += random(2, 1) * random(0.001, 0.005) / 1;
s+=0.002;
console.log(mouseX,mouseY);
}
function dateBar(){
let w = width/7;
for(h=0; h<7;h++){
push();
stroke('#f2eee9');
//noStroke();
fill(0,0,0)
strokeWeight(0.5);
//fill(colors[h]);
rect(-400+h*w,254,w,56);
pop();
push();
//fill();
textAlign(CENTER);
text(date[h],-400+w/2+h*w,283);
pop();
}
}
//function MousePreseed