twitter4j And little help for a noob?
in
Contributed Library Questions
•
10 months ago
Hello everyone!
I'm trying to put a timeline text with twitter4j in this code. For the moment, i'm trying to make twitter4j working, but, i can't find the "twitter4j.jar" etc.
is someone can told me (or send me to my email adress) this twitter4j.jar (i'm trrying to use he latest stable version)
I know it is a little bit stupid...
... And the second question: I need to make every particule like different text. do you have any solution?
here the code:
I'm trying to put a timeline text with twitter4j in this code. For the moment, i'm trying to make twitter4j working, but, i can't find the "twitter4j.jar" etc.
is someone can told me (or send me to my email adress) this twitter4j.jar (i'm trrying to use he latest stable version)
I know it is a little bit stupid...
... And the second question: I need to make every particule like different text. do you have any solution?
here the code:
- import codeanticode.syphon.*;
import controlP5.*;
ControlP5 cp5;
ControlWindow controlWindow;
SyphonClient client;
public int PersX = 100;
public int PersY = 100;
public float Zoom = 1.00;
float Taille = 20;
int num = 180;
float RADIUS = 550;
float SCALE = 450.0;
float cameraZ= (height/2.0) / tan(PI*60.0/360.0);
int globKonexID = 0;
Neuron n[];
void setup() {
size(displayWidth, displayHeight, P3D);
PFont maTypo = loadFont("Serif-30.vlw"); // choix de la typo
textFont(maTypo, Taille);// Définition de la taille de la typo
//////INTERFACE CONTROL
cp5 = new ControlP5(this);
controlWindow = cp5.addControlWindow("controlP5window", 100, 100, 300, 200)
.hideCoordinates()
.setBackground(color(150))
;
cp5.addSlider("PersX")
.setRange(0, 200)
.setPosition(40, 40)
.setSize(200, 20)
.setWindow(controlWindow)
;
cp5.addSlider("PersY")
.setRange(0, 200)
.setPosition(40, 80)
.setSize(200, 20)
.setWindow(controlWindow)
;
cp5.addSlider("Zoom")
.setRange(0, 2)
.setPosition(40, 120)
.setSize(200, 20)
.setWindow(controlWindow)
;
n = new Neuron[num];
for (int i = 0;i<n.length;i++) {
n[i] = new Neuron(i);
}
for (int i = 0;i<n.length;i++) {
n[i].makeConnections();
}
noSmooth();
stroke(1.0);
for (int i = 0;i<n[0].k.length;i++)
n[0].makeSignal(i);
}
void draw() {
float time = millis()*0.001;
background(0);
camera( 2550, -1850, 100, 0, 0, 0, 0, 10, 0 ); // Cammera
///PERSPECTIVE
float fov = PI/4.0;
float cameraZ = (height/2.0) / tan(fov/2.0);
perspective(fov*Zoom, float(width*PersX)/float(height*PersY), cameraZ/100.0, cameraZ*100.0);
////
rotate (-time*.2, time*.1, -time*.0, -time*.1); //ROTATION DU TOUT
for (int i = 0;i<n.length;i++) {
n[i].draw();
}
}
////////////////////////// >>
class Neuron {
float x, y, z, radius, xx, yy, zz, val;
int id;
boolean imobile = false;
Konexe k[] = new Konexe[0];
Signal sig[] = new Signal[0];
Neuron(int _id) {
xx = x = random(-width/2, width/2);
yy = y = random(-width/2, width/2);
zz = z = random(-width/2, width/2);
id= _id;
radius = RADIUS;
val = 0;
if (id==1)imobile = true;
}
void makeConnections() {
k = new Konexe[0];
sig = new Signal[0];
for (int i = 0 ;i<n.length;i++) {
if (i!=id && dist(x, y, z, n[i].x, n[i].y, n[i].z) < radius) {
k = (Konexe[])expand(k, k.length+1);
k[k.length-1] = new Konexe(id, i);
sig = (Signal[])expand(sig, sig.length+1);
sig[sig.length-1] = new Signal(k[sig.length-1]);
}
}
}
void makeSignal(int which) {
int i = which;
sig[i].x = xx;
sig[i].y = yy;
sig[i].z = zz;
sig[i].running = true;
}
void drawConnections() {
for (int i = 0 ;i<k.length;i++) {
line(xx, yy, zz, n[k[i].B].xx, n[k[i].B].yy, n[k[i].B].zz);
}
}
void draw() {
float time = millis()*0.1;
float niah = 1;
xx += (x-xx) / 100.0;
yy += (y-yy) / 100.0;
zz += (z-zz) / 100.0;
if (sig.length>0) {
for (int i = 0;i<sig.length;i+=1) {
if (sig[i].running) {
if (sig[i].moving) {
pushMatrix();
pushStyle();
strokeWeight(0);
fill(time*.4, random(0, 255), random(0, 255)); // COULEUR BOITES
//line(sig[i].x, sig[i].y, sig[i].z, sig[i].lx, sig[i].ly, sig[i].lz);
translate(sig[i].x, sig[i].y, sig[i].z);
//HERE I'M TRYING TO CHANGE THE TEXT TO TWITTER TIMELINE
if (niah == 1) {
text("hey ça va?", 0, 50);
}
if (niah == 2) {
text("bonjour", 0, 20);
}
if (niah == 3) {
text("t'as les plans?", 0, 30);
}
if (niah == 4) {
text("QUOI?", 0, 100);
}
if (niah == 5) {
text("tu charrettes?", 0, 54);
}
popStyle();
popMatrix();
}
sig[i].step();
}
}
}
stroke(lerpColor(#3300FF, #FFFFFF, norm(val, 10, 200)), 50); // Couleurs traits
drawConnections();
strokeWeight(4); //Epaisseur de traits
}
}
////////////////////////// >>
class Konexe {
int A, B, id;
float weight = 1.5;
Konexe(int _A, int _B) {
A = _A;
B = _B;
id = globKonexID++;
weight = random(50, 100)/SCALE;
}
}
class Signal {
Konexe base;
int cyc = 0;
float x, y, z, lx, ly, lz;
float speed = 10.1;
boolean running = false;
boolean visible = true;
boolean moving = false;
int deadnum = 2000;
int deadcount = 0;
Signal(Konexe _base) {
base = _base;
lx = x = n[base.A].x;
ly = y = n[base.A].y;
lz = z = n[base.A].z;
speed *= base.weight;
}
void step() {
running = true;
if (abs(lx-x)>.1||abs(ly-y)>.1||abs(lz-z)>.1)
moving = true;
else
moving = false;
lx = x;
ly = y;
lz = z;
if (!n[base.A].imobile) {
x += (n[base.B].xx-x) / speed*0.5;//(speed+(dist(n[base.A].x,n[base.A].y,n[base.B].x,n[base.B].y)+1)/100.0);
y += (n[base.B].yy-y) / speed*0.5;//(speed+(dist(n[base.A].x,n[base.A].y,n[base.B].x,n[base.B].y)+1)/100.0);
z += (n[base.B].zz-z) / speed*0.5;
}
n[base.A].val+=(0-n[base.A].val)/5000.0;
if (dist(x, y, z, n[base.B].xx, n[base.B].yy, n[base.B].zz)<1.0) {
if (deadcount<500000) {
deadcount = deadnum;
//deadnum += (int)random(-1,1);
//println("run "+base.A+" : "+base.B);
running = false;
for (int i = 0; i < n[base.B].k.length;i++) {
if (!n[base.B].sig[i].running && base.A!=n[base.B].sig[i].base.B) {
n[base.B].makeSignal(i);
n[base.B].sig[i].base.weight += (base.weight-n[base.B].sig[i].base.weight)/((dist(x, y, z, n[base.A].xx, n[base.A].yy, n[base.A].zz)+1.0)/200.0);
}
}
//base.weight = random(1001,3000) / 1000.0;
if (n[base.A].id!=1) {
n[base.A].xx+=((n[base.B].x-n[base.A].x)/1.1)*noise((frameCount+n[base.A].id)/18.0);
;
n[base.A].yy+=((n[base.B].y-n[base.A].y)/1.1)*noise((frameCount+n[base.A].id)/17.0);
n[base.A].zz+=((n[base.B].z-n[base.A].z)/1.1)*noise((frameCount+n[base.A].id)/16.0);
n[base.A].xx-=((n[base.B].x-n[base.A].x)/1.1)*noise((frameCount+n[base.B].id)/18.2);
;
n[base.A].yy-=((n[base.B].y-n[base.A].y)/1.1)*noise((frameCount+n[base.B].id)/17.2);
n[base.A].zz-=((n[base.B].z-n[base.A].z)/1.1)*noise((frameCount+n[base.B].id)/16.2);
}
lx = n[base.A].x;
ly = n[base.A].y;
lz = n[base.A].z;
n[base.A].val+=(255-n[base.A].val)/10.0;
}
else {
println("deadcount--");
}
}
}
}
1