PFont myFont = createFont("Futura", 20, true);
treize = loadShape("132.svg");
saison = loadShape("Saison.svg");
int a = (int)random(0,5);
int b = (int)random(1,10);
int c = (int)random(-20,-30);
int d = (int)random(0,20);
int c1 = (int)random(0,255);
int c2 = (int)random(0,200);
int w = (int)random(width/4,(width*(3/4)));
int h = (int)random((height / 4),height-(height / 6));
int pnb = (int)random(1,5);
int strokeColor = (int)random(150,255);
stroke(strokeColor,0,255);
int[] t = linspace(0, 2 * Math.PI, 1000);
for(int i=1; i < 1000; i++) {
complex ft = Swirly(t[i], a, b, c, d);
shape(saison, ft.x * 400, ft.y *400, 500, 500);
function linspace(float min, float max, int points) {
double[] d = new float[points];
for (int i = 0; i < points; i++){
d[i] = min + i * (max - min) / (points - 1);
function Swirly(float t, float a, float b, float c, float d) {
complex j1 = new complex(0, 1);
complex objComplexTemp = j1.times(t).times(a);
complex r1 = objComplexTemp.exp();
objComplexTemp = j1.times(t).times(b);
complex r2 = objComplexTemp.exp().divides(2);
objComplexTemp = j1.times(t).times(c);
objComplexTemp = j1.mult(objComplexTemp.exp());
complex r3 = objComplexTemp.divides(3);
objComplexTemp = j1.times(t).times(d);
complex r4 = objComplexTemp.exp().divides(4);
complex objComplex = r1.minus(r2).add(r3).add(r4);
String s = "Scrennshot_"+nf(numero,1)+".jpg";
saveFrame("line-####.tif");
return new complex(this.x + z.x,this.y + z.y);
this.minus = function(z){
return new complex(this.x - z.x,this.y - z.y);
return new complex(this.x * z.x - this.y * z.y ,this.x * z.y + this.y * z.x);
this.times = function(float z){
return new complex(this.x * z, this.y * z);
this.divides = function(float z){
return new complex(this.x / z, this.y / z);
return new complex(Math.exp(this.x) * Math.cos(this.y), Math.exp(this.x) * Math.sin(this.y));
this.scale = function(s){
return new complex(this.x * s ,this.y * s);
var r = sqrt(this.modulus());
var arg = this.arg()/2.0;
return new complex(r*cos(arg),r*sin(arg));
this.modulus = function() {
return sqrt(this.x * this.x + this.y * this.y);
return atan2(this.y,this.x);