Can you please help a student with some processing?
in
Programming Questions
•
3 months ago
Hi!
I am a student who has an assignment I need some help with. The task is to make data into coding, and I am not the best at that.
I am a student who has an assignment I need some help with. The task is to make data into coding, and I am not the best at that.
Every dot describes my instagram photoes. the size it the amount of likes, and the color is telling what kind of picture it is. This is what I have so far.
void setup(){
size(1000,420);
smooth();
background(0);
noStroke();
}
void draw() {
int [] hours = {10,18,11,12,20,18,17,21,19,22,19,23,17,14,16,11,18,21,13,20,11,20,1,13,11,21,23,21,19,18,14,17,14,15,20,17,21,13,14,18,9,22,17,6,19,23,16,13,15,0,17,12,14,15,18};
int [] days = {4,4,5,6,6,0,1,2,3,4,5,5,6,0,1,2,3,4,5,5,6,0,1,1,2,3,3,4,5,6,0,1,2,3,3,4,5,6,0,1,2,4,5,6,0,1,2,3,3,4,5,0,0,1,2};
int [] likes = {47,44,18,14,14,19,13,7,21,7,13,37,22,32,24,13,25,15,16,8,19,16,25,7,12,6,13,11,7,15,20,20,12,17,15,36,22,23,21,18,6,17,16,20,34,12,12,36,44,14,15,17,23,13,16};
color [] tagg = {
color(255,0,0),
color(255,0,0),
color(255,0,0),
color(255,100,0),
color(0,0,255),
color(255,0,255),
color(0,255,255),
color(255,0,255),
color(0,255,0),
color(0,255,255),
color(255,0,255),
color(0,255,0),
color(200,250,0),
color(0,255,0),
color(0,0,255),
color(255,0,255),
color(0,255,255),
color(255,0,255),
color(255,100,0),
color(255,100,0),
color(0,255,255),
color(255,0,0),
color(255,100,0),
color(255,0,255),
color(0,0,255),//
color(255,0,255),
color(255,100,0),
color(255,100,0),
color(0,0,255),
color(0,255,0),
color(0,255,0),
color(100,100,100),
color(255,0,0),
color(100,100,100),
color(255,100,0),
color(0,0,255),
color(255,0,255),
color(0,0,0),
color(0,0,255),
color(255,0,0),
color(200,255,0),
color(255,0,255),
color(0,255,255),
color(255,200,0),
color(255,0,255),
color(0,0,255),
color(0,255,0),
color(0,0,255),
color(255,0,0),
color(255,100,0),
color(0,0,255),
color(255,100,0),
color(0,255,255),
color(0,0,255),
color(0,0,255),
};
for(int i = 0; i < days.length; i++) {
fill (tagg[i]);
ellipse (hours[i]*40, days[i]*70, likes[i]*2, likes[i]*2); // (x,y, s, s);
}
}
The dots have to stay where they are, but I want to give them a growing effect. I found this code online. And is kind of what I would like.
float[] x, y, sz;
int [] cursz;
void setup()
{
size(400, 400);
smooth();
background(0);
colorMode(HSB, 360, 100, 100);
noFill();
strokeWeight(1);
frameRate(45);
int n = 7;
x = new float[n];
y = new float[n];
sz = new float[n];
cursz = new int[n];
for (int i = 0; i < x.length; i++) {
initShape(i);
}
}
void draw()
{
for (int i = 0; i < x.length; i++) {
drawRing(frameCount, x[i], y[i], cursz[i]);
cursz[i]++;
if (cursz[i] > sz[i]) {
initShape(i);
}
}
noStroke();
fill(0, 0, 0, 5);
rect(0, 0, width, height);
}
void initShape(int i)
{
x[i] = random(width);
y[i] = random(height);
sz[i] = 10 + random((width - 30)/ 3);
cursz[i] = (int) sz[i] / 2;
}
void drawRing(int count, float x, float y, int sz)
{
int hue = (count % 360 + (int) (x + y) ) % 360;
stroke(hue, 85, 95);
ellipse(x, y, sz, sz);
}
Can you pleace try to help me combining the two?
1