Based on shodo by Martin Schneider. The script outputs different states of drawing along the path data read from an svg file as pdf. These pdfs get recombined with a shell script.
The processing sketch is executed from within a bash script to render different files for multiple layers imported as different files. Afterwards the layers are combined again.
import geomerative.*; import processing.pdf.*;int i, k, howmanyframes, step, countframe; float startx, starty; float[] a = new float[18]; RGroup grp; RPoint[] points; String outputdir = "tmp/"; boolean recording = false; String[]vektorlist;void setup() { size(454, 325, P3D); //size(1816, 1300, P3D); // change size for thinner linesframeRate(500); stroke(0); smooth(); background(255);vektorlist = loadStrings("vektor.list"); String file = vektorlist[int(random(0, vektorlist.length))]; grp = vektorDB(file);countframe = -1; howmanyframes = 10; points = grp.getPoints(); startx = points[0].x; starty = points[0].y; //initialize with startpoint for(int x=0; x<a.length/2; x++) { a[x] = startx; a[x+9] = starty; } step = points.length / howmanyframes; int k = 0; }void draw() { if(k < points.length) { if(frameCount%step == 0 && frameCount != 0 && frameCount != 1) { countframe++; beginRecord(PDF, outputdir + "sho--" + nf(countframe,5) + ".pdf"); recording = true; }for(int m=0; m<=k ; m++) {a[9]=points[m].y; a[0]=points[m].x;pushMatrix(); scale(1.5); translate(-100,-100);for(i=0;++i<9;) { if (m == 0) { line(0, random(0,height), a[i] += (a[i-1]-a[i])/i, a[i+9] += (a[i+8]-a[i+9])/i ); } else if (m == k) { line(a[i], a[i+9], width, random(0,height)); } else { line(a[i], a[i+9], a[i] += (a[i-1]-a[i])/i, a[i+9] += (a[i+8]-a[i+9])/i ); } }popMatrix();}if(recording) { endRecord(); }//reset to startpoints for(int x=0; x<a.length/2; x++) { a[x] = startx; a[x+9] = starty; } k++; } else { exit(); } }RGroup vektorDB(String svgpath){RGroup grp,svg; RShape svgload; int pathnumber;// VERY IMPORTANT: Allways initialize the library in the setup RG.init(this);svgload = RG.loadShape(svgpath); grp = new RGroup();pathnumber = int(split(loadStrings(svgpath)[1],' ')[1]);for(int i=1; i<=pathnumber; i++){ grp.addElement(svgload.getChild(str(int(i)))); } return grp; }