Spiral spir = new Spiral(); Spiral buu = new Spiral(); Spiral treo = new Spiral(); Bez it0, it, it2; float t = 0; float s = 0; float r = 0; float to = 0; float so = 0; float ro = 0; boolean complete0 = false; boolean complete = false; boolean complete2 = false; void setup() { size(1000, 1200, P3D); background(0); noFill(); smooth(); makeSpiral(treo, 2, 30); makeSpiral(spir, 0, 40); makeSpiral(buu, 1, 20); flip(buu); it0 = treo.head; it = spir.head; it2 = buu.head; /*it0 = treo.tail; it = spir.tail; it2 = buu.tail;*/ } void draw() { //background(0); ortho(-width/2, width/2, -height/2, height/2, -10, 10); if (!complete) { Pack e = drawSpir(spir, it, width/20, 4*height/5, t, to, complete); it = e.it; t = e.t; to = e.to; complete = e.complete; } else { //eraseSpir(spir, it, width/20, 4*height/5, t, complete); if (!complete2) { Pack e2 = drawSpir(buu, it2, 3*width/6, height/5, s, so, complete2); it2 = e2.it; s = e2.t; so = e2.to; complete2 = e2.complete; } else { if (!complete0) { Pack e0 = drawSpir(treo, it0, 5*width/7, height/6, r, ro, complete0); it0 = e0.it; r = e0.t; ro = e0.to; complete0 = e0.complete; } } } /* drawSpiral(treo, 5*width/7, height/6); drawSpiral(spir, width/20, 4*height/5); drawSpiral(buu, 3*width/6, height/5);*/ } Pack drawSpir(Spiral s, Bez it, float posX, float posY, float t, float to, boolean complete) { Bez it2 = null; if (it.prev != null) { if (it.prev.prev != null) { it2 = it.prev.prev; } } if (t < 1) { float t2 = t; if (it2 != null) { t = ani2(it2, posX, posY, t, to+2); } t = ani1(it, posX, posY, t2, to); to += t; } else { if (it.next != null) { it = it.next; } else { complete = true; } t = 0; } Pack e = new Pack(it, t, to, complete); return e; } Pack backwards(Spiral s, Bez it, float posX, float posY, float t, boolean complete) { if (t < 1) { float t2 = t; t = secondline(it, posX, posY, t); t = ani(it, posX, posY, t2); } else { if (it.prev != null) { it = it.prev; } else { complete = true; } t = 0; } Pack e = new Pack(it, t, to, complete); return e; }