and i want to change it so that the points animate constantly and smoothly between new random positions.
but i dont understand the best way to achieve this animation with points in Processing.
using basic if/else structure i have mocked up the most primitve version of what i want (but only runs once motion once, the reset point isnt working?).. would love advice on the correct animation method and how to get more sophisticated maths for the movement. thanks! :)
int numPoints = 12;
PVector[] points = new PVector[numPoints]; PVector[] newPoints = new PVector[numPoints]; void setup() { size( 450, 400 );
for (int i = 0; i < numPoints; i++) { points[i] = new PVector( random(width), random(height) ); newPoints[i] = new PVector( random(width), random(height) ); }
//noLoop();
}
void draw() { smooth(); background(0); noFill();
for (int i = 0; i < numPoints; i++) { for (int j = 0; j < numPoints; j++) { strokeWeight(1); if ( j != i ) { float dst = dist( points[i].x, points[i].y, points[j].x, points[j].y ); // if ( dst < 255 ) { stroke( 255, 255 - 0); line( points[i].x, points[i].y, points[j].x, points[j].y ); // } } } stroke( 255 ); strokeWeight(4); point( points[i].x, points[i].y );