float res; float num; int[] data; int z=0; float framesize=1; float shiftSize; float alpha1; float alpha2; float alpha3; float alpha4; float alpha5; float alpha6; float extentFrames; float extentDegs; float limit1; float limit2; float limit3; float limit4; float limit5; float eqamt1 =360; //Or from data file, amt1 float lamt1; float lamt2; float lamt3; float diamad1; float olen1; float olen2; float olen3; float olen4; float olen5; float olen6; float x0 = 400; float y0 = 350; float x1; float y1; float x2; float y2; float x3; float y3; float x4; float y4; float x5; float y5; float x6; float y6; int amtres=2; float lenad1; float lenad2; float lenad3; float lenres1; float lenres2; float lenres3; float ang; float px; float py; float cx; float cy; int deg; void move(float ang1, float amt1, float ang2, float amt2, float ang3, float amt3, // float ang4, float amt4, float ang5, float amt5, float ang6, float amt6, // float trc1, float trc2, float trc3, float trc4, float trc5, float trc6, // float len1, float lenad1, float len2, float lenad2, float len3, float lenad3, // float len4, float lenad4, float len5, float lenad5, float len6, float lenad6, // float diam1, float diamad1, float diam2, float diamad2, float diam3, float diamad3, // float diam4, float diamad4, float diam5, float diamad5, float diam6, float diamad6, float colR1, float colG1, float colB1, float alpha1, float colR2, float colG2, float colB2, float alpha2, float colR3, float colG3, float colB3, float alpha3, float colR4, float colG4, float colB4, float alpha4, float colR5, float colG5, float colB5, float alpha5, float colR6, float colG6, float colB6, float alpha6) { //float res1 if (amt1<0) { // res1=-res1; } float num=amt1/res; //i.e. number of steps in movement (same for all links) float res2=amt2/num; if (amt2<0) { // res2=-(amt2/num);} res2=-res2; } float res3=amt3/num; if (amt3<0) { // res3=-(amt3/num);} res3=-res3; } float res4=amt4/num; if (amt4<0) { res4=-(amt4/num); } float res5=amt5/num; if (amt5<0) { res5=-(amt5/num); } float res6=amt6/num; if (amt6<0) { res6=-(amt6/num); } float lenres1=lenad1/num; float lenres2=lenad2/num; float lenres3=lenad3/num; float lenres4=lenad4/num; float lenres5=lenad5/num; float lenres6=lenad6/num; diamad1=diamad1/num; diamad2=diamad2/num; diamad3=diamad3/num; diamad4=diamad4/num; diamad5=diamad5/num; diamad6=diamad6/num; if (z>=num) { z=0; } if (z % res == 0) { //////////////////// STARTING POSITIONS ////////////////////////////////////////// translate (0, 0); rotate (radians(ang1)); pushMatrix(); noStroke(); if (trc1==2) { line (0, 0, len1, 0); //l-1 posn1 (starting position) } translate (len1, 0); rotate (radians(ang2)); noStroke(); if (trc2==2) { line(0, 0, len2, 0); //l-2 (starting position) } translate (len2, 0); rotate (radians(ang3)); noStroke(); if (trc3==2) { line (0, 0, len3, 0); //l-3 (starting position) } translate (len3, 0); rotate (radians(ang4)); noStroke(); if (trc4==2) { line(0, 0, len4, 0); //l-4 (starting position) } translate (len4, 0); rotate (radians(ang5)); noStroke(); if (trc5==2) { line (0, 0, len5, 0); //l-5 (starting position) } translate (len5, 0); rotate (radians(ang6)); noStroke(); if (trc6==2) { line (0, 0, len6, 0); //l-6 (starting position) } popMatrix(); /////////////// MOVEMENTS ////////////////////////////////////////////// // pushMatrix(); translate (300, 200); rotate (radians(res*z)*framesize); //"framesize" determines visible res; amount // must be limited to correct range (num?) len1=len1 + (lenres1*z); if (trc1==0) { noStroke(); } if (trc1==1) { stroke(colR1, colG1, colB1, alpha1); line ( 0, 0, len1, 0); } if (trc1==2) { noStroke(); fill (colR1, colG1, colB1, alpha1); ellipse (len1, 0, diam1+diamad1*z, diam1+diamad1*z); } translate (len1, 0); if (amt2<0) { //NOTE DUPLICATION - SEE LL 102-120 res2=-res2; } rotate (radians(ang2+res2*z)*framesize); len2=len2 + (lenres2*z); if (trc2==0) { noStroke(); } if (trc2==1) { stroke(colR2, colG2, colB2, alpha2); line (0, 0, len2, 0); } if (trc2==2) noStroke(); fill (colR2, colG2, colB2, alpha2); ellipse (len2, 0, diam2+diamad2*z, diam2+diamad2*z); translate (len2, 0); if (amt3<0) { //NOTE DUPLICATION - SEE LL 102-120 res3=-res3; } rotate (radians(ang3+res3*z)*framesize); len3=len3 + (lenres3*z); if (trc3==0) { noStroke(); } if (trc3==1) { stroke(colR3, colG3, colB3, alpha3); line (0, 0, len3, 0); } if (trc3==2) { noStroke(); fill (colR3, colG3, colB3, alpha3); ellipse (len3, 0, diam3+diamad3*z, diam3+diamad3*z); } translate (len3, 0); if (amt4<0) { res4 = -res4; } rotate (radians(ang4+res4*z)*framesize); len4=len4 + (lenres4*z); if (trc4==0) { noStroke(); } if (trc4==1) { stroke(colR4, colG4, colB4, alpha4); line(0, 0, len4, 0); } if (trc4==2) { noStroke(); fill (colR4, colG4, colB4, alpha4); ellipse (len4, 0, diam4+diamad4*z, diam4+diamad4*z); } translate(len4, 0); if (amt5<0) { //NOTE DUPLICATION - SEE LL 102-120 res5=-res5; } rotate (radians(ang5+res5*z)*framesize); len5=len5 + (lenres5*z); if (trc5==0) { noStroke(); } if (trc5==1) { stroke(colR5, colG5, colB5, alpha5); line(0, 0, len5, 0); } if (trc5==2) { noStroke(); fill(colR5, colG5, colB5, alpha5); ellipse (len5, 0, diam5+diamad5*z, diam5+diamad5*z); } translate (len5, 0); if (amt6<0) { //NOTE DUPLICATION - SEE LL 102-120 res6=-res6; } rotate (radians(ang6+res6*z)*framesize); len6=len6 + (lenres6*z); if (trc6==0) { noStroke(); } if (trc6==1) { stroke(colR6, colG6, colB6, alpha6); line(0, 0, len6, 0); } if (trc6==2) { noStroke(); fill (colR6, colG6, colB6, alpha6); ellipse (len6, 0, diam6+diamad6*z, diam6+diamad6*z); } //popMatrix(); if (z>=num) { //determines extent of traceform (derived from amt1) z=0; } } } /* __________________________________________________________________________________ SETUP (applies overall and is stated once for a composition) __________________________________________________________________________________ */ void setup() { size (1000, 700); smooth(); //background (169, 100, 229); background (20, 60, 90); stroke(10, 150, 250); strokeWeight(2); frameRate(10); res=.5; //RESOLUTION IN DEGREES } void draw () { z=z+1; // counts incremental repeats of points() /* _______________________________________________________________________________________ MOVEMENTS : INPUT _______________________________________________________________________________________ */ //MOVE 1 extentDegs=180; //movement of link 1 extentFrames=extentDegs/res; //converted to frames limit1=extentFrames; //total draw() cycles so far if (frameCount<(limit1)) { //translate(1320, 560); translate(1200, 560); //etc rotate(radians(-10)); /* * * * * * */ move( 182, 180, 9, -390, 10, -90, 10, 180, 10, -45, 10, 0, 1, 1, 2, 0, 1, 1, 10, 500, 110, -305, 150, -350, 300, -90, 10, 550, 450, 900, 0, 0, 0, 0, 0, 200, 0, 0, 50, -60, 0, 0, 255, 155, 55, 20, 0, 255, 0, 70, 255, 155, 55, 20, 0, 0, 0, 0, 255, 155, 55, 70, 0, 255, 0, 70 ); //MOVE 2 ...etc } else { noLoop(); } // To create file of all frames: saveFrame("Six_Links-####.tif"); }