theShader = new p5.Shader(this._renderer, vert, frag)
createCanvas(400, 400 , WEBGL);
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.);
// returns a value between 0.1 and 0.15
return (sin(A) + 5.)*0.025;
float randomA (vec2 st) {
return fract2(sin(dot(floor(st.xy),
vec2(12.9898,78.233)))* 43758.5453123);
float random (float st) {
return randomA(vec2(st));
//float mylen(vec2 q ,vec2 p){
//float fac = 1.;// abs(p.y - 0.2*sin(t)-1.);
//float c1 = min(fac*(abs(q.y) + abs(4.*q.x)),fac*(abs(q.x) + abs(4.*q.y)));
//vec2 qq = 0.5*vec2(q.x + q.y,q.x - q.y);
//float c2 = min(fac*(abs(qq.y) + abs(4.*qq.x)),fac*(abs(qq.x) + abs(4.*qq.y)));
float mylen(vec2 q, vec2 p){
mat2 m3 = mat2(cos(2.*p.x*tt),-sin(2.*p.y*tt),sin(2.*p.y*tt),cos(2.*p.x*tt));
float fac = 1.;//abs(p.y - 4.);
float c1 = min(fac*(abs(q1.y) + abs(40.*q1.x)),fac*(abs(q1.x) + abs(40.*q1.y)));
float ang = PI;//t;//*sin(t*10.)*0.4;
mat2 m2 = mat2(cos(ang),-sin(ang),sin(ang),cos(ang));
vec2 qq = m3*m2*q; //0.5*vec2(q.x + q.y,q.x - q.y);
float c2 = min(fac*(abs(qq.y) + abs(40.*qq.x)),fac*(abs(qq.x) + abs(40.*qq.y)));
else {return ((a*L2 - b*L1) + t*(L1-L2))/(a-b);}
// I want a fucntion that goes from 1 to 100 nicely
else {return 6. - 5.*cos(PI*(u-a)/(b-a));}
vec2 p = vec2(gl_FragCoord.xy-r)*5.5 / min(r.x, r.y);
vec3 destColor = vec3(0.0);
for(float ii=-6.; ii < 6.; ii++) {
for(float kk=-5.0; kk < 5.; kk++) {
// lets keep track of which vecgtors are the closet ones:
vec2 qq = - max(min(vec2(random(k+random(10.-k))*cos(j*tt*sp+l), ff(t)*random(i+random(i))*sin(l*tt*sp+j)) * (100.+ ff(t)),5.),-5.)
- vec2(k + 0.5*mod(i,2.),i*0.3)*1.2 ;
else if (L < 4.*mydist2){
float L2 = mylen(p-qq-vec2(0.4,0.4),p);
float Lc = pow(1.-L2,2.)*(4.-p.y)*2.;
for (float ww=0.;ww<24.;ww++){
vec2 qqw = qq + vec2(cos(PI*ww/8.+t*0.3),sin(PI*ww/8.+t*0.3))/2.;
if (L1<0.09){destColor = vec3(1.,0.6,0.6);}
else if (L1<0.1){destColor = vec3(.4,0.0,0.);}
if (L<0.5){destColor = vec3(1.,0.6,0.6);}
for (float ww=0.;ww<24.;ww++){
vec2 qqw = qq + vec2(cos(PI*ww/8.-t*0.3),sin(PI*ww/8.-t*0.3))*.3;
if (L1<0.05){destColor = vec3(1.,0.9,0.8);}
else if (L1<0.06){destColor = vec3(.4,0.0,0.);}
if (L<0.3){destColor = vec3(1.,0.9,0.8);}
for (float ww=0.;ww<24.;ww++){
vec2 qqw = qq + vec2(cos(PI*ww/8.+t*0.3),sin(PI*ww/8.+t*0.3))*.2;
if (L1<0.03){destColor = vec3(1.,1.,0.8);}
else if (L1<0.04){destColor = vec3(.4,0.0,0.);}
if (L<0.2){destColor = vec3(1.,1.,0.8);}
if (L<0.61 && L>0.6 ){destColor = vec3(.4,0.0,0.);}
gl_FragColor = vec4(destColor,1.);
var str= window.location.href;
var str2 = (str.split("/")[3]).split(".")[0] + ".jpg" ;
if (frameCount - lapse > 15){