theShader = new p5.Shader(this._renderer, vert, frag)
shaderTexture = createGraphics(400, 400, WEBGL);
shaderTexture.noStroke();
createCanvas(400, 400 , WEBGL);
shaderTexture.shader(theShader);
theShader.setUniform("r", [width, height]);
theShader.setUniform("t", millis() / 1000.0);
theShader.setUniform("m", [mouseX, map(mouseY, 0, height, height, 0)]);
shaderTexture.rect(0,0,width,height);
rect(-0.5*width, -0.5*height, width, height);
attribute vec3 aPosition;
attribute vec2 aTexCoord;
vec4 positionVec4 = vec4(aPosition, 1.0);
positionVec4.xy = positionVec4.xy * 2.0 - 1.0;
gl_Position = positionVec4;
uniform vec2 r; // resolution
vec2 P1= vec2(100.,100.);
vec2 P2= vec2(100.,100.);
vec2 P3= vec2(100.,100.);
float lam1 = 170.*pow(1.5/6.,0.5);
float lam2 = 170.*pow(1.5/2.,0.5);
vec3 vc1 = vec3(170.,170.,170.);
vec3 vc2 = vec3(1.,1.,-2.);
vec3 vc3=vec3(1.,-1.,0.);
float temp1 = vc1[0] + cos(r*2.*PI/100.)*lam1*vc2[0] + sin(t*2.*PI/100.)*lam2*vc3[0];
float temp2 = vc1[1] + cos(r*2.*PI/100.)*lam1*vc2[1] + sin(t*2.*PI/100.)*lam2*vc3[1];
float temp3 = vc1[2] + cos(r*2.*PI/100.)*lam1*vc2[2] + sin(t*2.*PI/100.)*lam2*vc3[2];
return vec3(temp1,temp2,temp3)/255.;
float mymod(float a, float b){
// compute angle: let it return a number between 0 and 2pi
float aa = atan(q.y/q.x);
if (q.x >=0. && q.y >= 0.){ return atan(q.y/q.x);}
else if (q.x >=0. && q.y < 0.){return mymod(2.*PI+atan(q.y/q.x),2.*PI);}
else {return mymod(PI + atan(q.y/q.x),2.*PI);}
// argument of a complex number
// compute angle: let it return a number between 0 and 2pi
float aa = atan(q.y/q.x);
if (q.x >=0. && q.y >= 0.){ return atan(q.y/q.x);}
else if (q.x >=0. && q.y < 0.){return mymod(2.*PI+atan(q.y/q.x),2.*PI);}
else {return mymod(PI + atan(q.y/q.x),2.*PI);}
// complex multiplication
vec2 cmxmult(vec2 A, vec2 B){
return vec2(A.x*B.x - A.y*B.y, A.x*B.y + B.x*A.y);
vec2 cmxpow(vec2 q, float m){
return pow(len,m)*vec2(cos(m*ang),sin(m*ang));
// given tau, find q=exp(2*PI*I tau)
vec2 q0 = 2.*PI*vec2(-tau.y,tau.x);
return exp(q0.x)*vec2(cos(q0.y),sin(q0.y));
vec2 eta(vec2 tau,float N){
vec2 s = cmxpow(q,1./24.);
for (float n = 1.; n<40.; n++){
s = cmxmult(s,vec2(1.,0.) -cmxpow(q,n));
vec3 mycol(float col, vec2 p, vec3 destcol){
if(destcol == vec3(0.0,0.,0.5)) {return vec3(0.0,0.,0.5);}
if(abs(p.x) < 1.5 && abs(p.y)<1.5
!(abs(p.x) < 0.5 && abs(p.y)<.5 ))
{return nicecol(max(abs(p.x),abs(p.y))*100.);}
else if(abs(p.x) < 0.5 && abs(p.y)<.5 ){
{return vec3(0.0,0.,0.5);}
else {return vec3(0.0,0.,0.);}
return bool(abs(p.x)<=.5 && abs(p.y)+abs(p.x)<=1.5 && p.y>=0.);
vec2 rr = vec2(gl_FragCoord.x-r.x,-gl_FragCoord.y+r.y)*2./ min(r.x, r.y);
vec2 p= mix(mix(vec2(atan(rr.y/rr.x),-log(length(rr))),rr,cos(t)),vec2(atan(rr.y/rr.x),log(length(rr))),cos(t*0.5));
p=mix(eta(p,10.),p,sin(tt));
float ang = -PI/4.+t*0.1;
mat2 m = mat2(cos(ang),-sin(ang),sin(ang),cos(ang));
for(float i = 0.;i<5.;i++){
if(i<abs(sin(t*0.3))*5.){
destColorA=mycol(col,p,destColor);
p = m*3.*(fract(p+vec2(0.5))-vec2(0.5));
if (destColorA != vec3(0.)){destColor=destColorA;}
gl_FragColor = vec4(destColor,1.);
var str= window.location.href;
var str2 = (str.split("/")[3]).split(".")[0] + ".jpg" ;
if (frameCount - lapse > 15){