help meee :D
in
Contributed Library Questions
•
1 year ago
hi everybody,
i'm an absolute beginner of processing...can anybody help me? i need to find the part of the sketch, where i can change the color of the bar charts. also i would like to know how to adapt the length of the ''dropping water'', so that it is as log as the bars in the background. pleaseee :-)
import org.gicentre.utils.stat.*;
BarChart barChart;
boolean click =false;
int a = 1000;
PVector[] pos;
PVector[] vel;
int[] ttl;
float pmx = 0;
float pmy = 0;
float r = 70;
float g = 130;
float b = 220;
float ca = 200;
void setup(){
size(900,700);
smooth();
frameRate(50);
pos = new PVector[a];
vel = new PVector[a];
ttl = new int[a];
for ( int i = 0; i < a; i++) {
pos[i] = new PVector(0, 0);
if (i < a/1000) {
vel[i] = new PVector(random(-2, 2), random(-5, -5));
ttl[i] = int(random(10, 50));}
else {
vel[i] = new PVector(random(0, 400), random(0, 400));
ttl[i] = int(random(0, 50));}
barChart = new BarChart(this);
barChart.setData(new float[]
{978,0, 735,0, 612,0, 450,0, 305,0, 205,0, 94,0, 59,0, 20,0});}
}
void draw() {
background(255);
barChart.draw(60,10,width-60,height-60);
smooth ();
//fill (255,50,50); //fountaine
//fill(255); //background
noStroke();
//rect(0, 0, width, height);
stroke(r, g, b,ca);
smooth();
if(click == true){
for ( int i = 0; i < a; i++) {
point( pos[i].x + 80, pos[i].y + 20 );}
for ( int i = 0; i < a; i++) {
point( pos[i].x + 175, pos[i].y + 175 );}
for ( int i = 0; i < a; i++) {
point( pos[i].x + 270, pos[i].y + 260 );}
for ( int i = 0; i < a; i++) {
point( pos[i].x + 362, pos[i].y + 358 );}
for ( int i = 0; i < a; i++) {
point( pos[i].x + 455, pos[i].y + 450 );}
for ( int i = 0; i < a; i++) {
point( pos[i].x + 550, pos[i].y + 520 );}
for ( int i = 0; i < a; i++) {
point( pos[i].x + 642, pos[i].y + 590 );}
for ( int i = 0; i < a; i++) {
point( pos[i].x + 737, pos[i].y + 610 );}
for ( int i = 0; i < a; i++) {
point( pos[i].x + 832, pos[i].y + 640 );}
pmx = mouseX;
pmy = mouseY;
a = 400;
} else {
if(a > 1) {
a = int(a*0.99);
}
for ( int i = 0; i < a; i++) {
point( pos[i].x + pmx, pos[i].y + pmy );
}
pmy = pmy * 5.05;
}
for ( int i = 0; i < a; i++) {
pos[i].add( vel[i] );
ttl[i]--;
if (ttl[i] < 0) {
vel[i] = new PVector(random(0, -5), random(0, 5));
pos[i] = new PVector(random(-20, 30), random(-10, 30));
ttl[i] = int(random(0,100));
}
}
}
void mousePressed() {
ca = random(100, 100);
strokeWeight(random(5));
click= true;
}
i'm an absolute beginner of processing...can anybody help me? i need to find the part of the sketch, where i can change the color of the bar charts. also i would like to know how to adapt the length of the ''dropping water'', so that it is as log as the bars in the background. pleaseee :-)
import org.gicentre.utils.stat.*;
BarChart barChart;
boolean click =false;
int a = 1000;
PVector[] pos;
PVector[] vel;
int[] ttl;
float pmx = 0;
float pmy = 0;
float r = 70;
float g = 130;
float b = 220;
float ca = 200;
void setup(){
size(900,700);
smooth();
frameRate(50);
pos = new PVector[a];
vel = new PVector[a];
ttl = new int[a];
for ( int i = 0; i < a; i++) {
pos[i] = new PVector(0, 0);
if (i < a/1000) {
vel[i] = new PVector(random(-2, 2), random(-5, -5));
ttl[i] = int(random(10, 50));}
else {
vel[i] = new PVector(random(0, 400), random(0, 400));
ttl[i] = int(random(0, 50));}
barChart = new BarChart(this);
barChart.setData(new float[]
{978,0, 735,0, 612,0, 450,0, 305,0, 205,0, 94,0, 59,0, 20,0});}
}
void draw() {
background(255);
barChart.draw(60,10,width-60,height-60);
smooth ();
//fill (255,50,50); //fountaine
//fill(255); //background
noStroke();
//rect(0, 0, width, height);
stroke(r, g, b,ca);
smooth();
if(click == true){
for ( int i = 0; i < a; i++) {
point( pos[i].x + 80, pos[i].y + 20 );}
for ( int i = 0; i < a; i++) {
point( pos[i].x + 175, pos[i].y + 175 );}
for ( int i = 0; i < a; i++) {
point( pos[i].x + 270, pos[i].y + 260 );}
for ( int i = 0; i < a; i++) {
point( pos[i].x + 362, pos[i].y + 358 );}
for ( int i = 0; i < a; i++) {
point( pos[i].x + 455, pos[i].y + 450 );}
for ( int i = 0; i < a; i++) {
point( pos[i].x + 550, pos[i].y + 520 );}
for ( int i = 0; i < a; i++) {
point( pos[i].x + 642, pos[i].y + 590 );}
for ( int i = 0; i < a; i++) {
point( pos[i].x + 737, pos[i].y + 610 );}
for ( int i = 0; i < a; i++) {
point( pos[i].x + 832, pos[i].y + 640 );}
pmx = mouseX;
pmy = mouseY;
a = 400;
} else {
if(a > 1) {
a = int(a*0.99);
}
for ( int i = 0; i < a; i++) {
point( pos[i].x + pmx, pos[i].y + pmy );
}
pmy = pmy * 5.05;
}
for ( int i = 0; i < a; i++) {
pos[i].add( vel[i] );
ttl[i]--;
if (ttl[i] < 0) {
vel[i] = new PVector(random(0, -5), random(0, 5));
pos[i] = new PVector(random(-20, 30), random(-10, 30));
ttl[i] = int(random(0,100));
}
}
}
void mousePressed() {
ca = random(100, 100);
strokeWeight(random(5));
click= true;
}
1