particle_system/atractor.pde

46 lines
831 B
Plaintext

// il y aura 10 attractor, plus on ne fera pas
public class Attractor
{
PVector pos;
float weight;
boolean is_active;
float circle_radius;
int col;
int circle_pt;
Attractor(){
pos = new PVector(0, 0, 0);
is_active = false;
weight = 20;
circle_radius = 20;
col = getColInt(0, 0, 50);
circle_pt = 10;
}
void draw(){
if (is_active){
if (att_stdout)
laser_frame.add_line(create_circle(pos.x, pos.y, circle_radius, circle_pt, col));
else
processing_draw_line(create_circle(pos.x, pos.y, circle_radius, circle_pt, col));
}
}
// we need to remap position from the leap motion
void update_pos(PVector p){
pos.x = ( p.x - 0) * 1;
pos.y = (70. - p.z) * (800.0 / 70.0);
is_active = true;
}
// void update_position(float px, float py){
// pos.x = px;
// pos.y = py;
// }
}