//////////////////////////////////////////////////////// Using DREW FOR PROCESSING //////////////////////////////////////////////// // Introduction 2X float res; float num; int[] data; int z=0; float framesize=1; float alpha1; float alpha2; float alpha3; float extentFrames; float extentDegs; float limit1; float limit2; float limit3; float diamad1; int amtres=2; float lenad1; float lenad2; float lenad3; float lenres1; float lenres2; float lenres3; float ang; int deg; void move(float ang1, float amt1, float ang2, float amt2, float ang3, float amt3, // float trc1, float trc2, float trc3, // float len1, float lenad1, float len2, float lenad2, float len3, float lenad3, // float diam1, float diamad1, float diam2, float diamad2, float diam3, float diamad3, // float colR1, float colG1, float colB1, float alpha1, float colR2, float colG2, float colB2, float alpha2, float colR3, float colG3, float colB3, float alpha3) { if (amt1<0) { } 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 lenres1=lenad1/num; float lenres2=lenad2/num; float lenres3=lenad3/num; diamad1=diamad1/num; diamad2=diamad2/num; diamad3=diamad3/num; if (z>=num) { z=0; } if (z % res == 0) { ///////////Strarting 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); popMatrix(); ////////Movements: //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) { //Duplicatiom 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) { //Duplication 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); z=z+1; // counts incremental repeats of points() 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); //background (0, 60, 70); stroke(10, 150, 250); strokeWeight(1); frameRate(15); res=.5; //RESOLUTION IN DEGREES } void draw () { /* ____________________________________________________________________________________ MOVEMENTS : INPUT ____________________________________________________________________________________ */ //MOVE 1 extentDegs=90; //movement of link 1 extentFrames=extentDegs/res; //converted to frames limit1=extentFrames; //total draw() cycles so far if (frameCount<(limit1)) { translate(700, 300); //rotate(radians(-10)); /* * * */ move( 180, 90, 180, 0, 10, 0, 2, 2, 2, 200, 0, 50, 150, 150, 50, 6, 0, 100, 0, 30, 150, 255, 0, 0, 155, 0, 255, 0, 255, 0, 0, 255, 155 ); //MOVE 2 extentDegs=30; //movement of link 1 extentFrames=extentDegs/res; //converted to frames limit2=limit1+extentFrames; //total draw() cycles so far } else if (frameCount<(limit2)) { translate(500, 300); //rotate(radians(-10)); move( 180, 30, 0, 60, 10, -180, 1, 1, 1, 110, 5, 110, 5, 150, 5, 0, 0, 0, 0, 0, 0, //255, 255, 0, 200, 255, 255, 0, 200, 255, 255, 0, 200 0, 255, 0, 200, 255, 0, 0, 200, 0, 0, 255, 200 ); } else { noLoop(); } // To create file of all frames: //saveFrame("File name-####.tif"); }