xxxxxxxxxx
116
//ideally this would be viewed full screen but you can make it work in the smaller window too if you scroll around a bit
var t = 0; //time
var sc = 300;
var scal = 1;
var n = [0]; //x coords for input points
var o = [0]; //y coords for input points
var ns = 0;
var n2s = 0;
function setup() {
var x = 1;
var y = 1;
var tuner = (5 * PI) / 13 / 2; //why 5/13 works I haven't the foggiest, must be tuned for new values of x and y
var ga = atan(y / x);
angleMode("radians");
frameRate(6);
createCanvas(1200, 1200, WEBGL);
strokeWeight(1);
stroke(255, 0, 255);
for (var i = -16; i < 17; i += 1) {
for (var j = -16; j < 17; j += 1) {
for (var k = -8; k < 9; k++) {
if (k % 2 == 0) {
for(var l = 0; l<9; l++){
n.push(32*(((1 * (i )) / y + (j + k / 16 ) / x) * tuner)/(4**l));
o.push(32*(((1 * (i )) / x - (j + k / 16 ) / y) * tuner)/(4**l));
ns = n[n.length - 1];
point(600 + ns * sc, 600 + o[o.length - 1] * sc);
}
}
else {
for(var l = 0; l<9; l++){
n.push(32*(((1 * (i + k / 16 )) / y + (j ) / x) * tuner)/(4**l));
o.push(32*(((1 * (i + k / 16 )) / x - (j ) / y) * tuner)/(4**l));
ns = n[n.length - 1];
point(600 + ns * sc, 600 + o[o.length - 1] * sc);
}
} //it took me about 12 hours+ to get this semi-worked out
}
}
}
}
var n2 = 0; //x coords for output points
var o2 = 0; //y coords for output points
var L = 0;
var N = 0;
var A = 1/40;
var B = 1/40;
var D = 1/40;
var E = 1/40;
var F = 1/40;
var G = 1/40;
var W = 0;
var V = 0;
var an = 157.6255960832;//157.6255960832
an = 45;
var amount = 0.413; //changes number of "leafs" and I think pitch of spiralling
var gapangle = 2.00;//it seems to be inverse to gap angle
scal = 1;
function draw() {
background(0);
stroke(255, 0, 0);
strokeWeight(1);
//point(600, 600);//this point helps cheat and pretend things go to infinity
noFill();
circle(600,600,scal*108/4);
circle(600,600,scal*216/4);
circle(600,600,scal*432/4);
circle(600,600,scal*864/4);
circle(600,600,scal*54/4);
circle(600,600,scal*27/4);
circle(600,600,scal*1728/4);
circle(600,600,scal*3456/4);
strokeWeight(1);
scal = ((scal*1.03)%4);
if(scal<1){
scal++;
}
//amount = 1/0.117;// + (2.92*sin(t/10)/1); //1.71 0.117
t++;
for (var i = 0; i < n.length; i++) {
F = scal*n[i]/4;
G = scal*o[i]/4;
L = (D*A+E*B)/(D*D+E*E);
N = (D*B-E*A)/(D*D+E*E);
// noprotect
n2 = gapangle*(L*log(sqrt(F*F+G*G))/log(amount)-N*atan2(F,G)-2*PI*E);//why 1.081 I don't know!
o2 = gapangle*(N*log(sqrt(F*F+G*G))/log(amount)+ L*atan2(F,G)+2*PI*D);//1.081 changes the gap angle in pac man's mouth
stroke(255, 0,0);
//point(600 + n2 * sc, 600 + o2 * sc);
n2s = n2;
n2 = 0.707*(cos(an*2*PI/360)*n2 - sin(an*2*PI/360)*o2);
o2 = 0.707*(sin(an*2*PI/360)*n2 + cos(an*2*PI/360)*o2);
stroke(0,0,255);
//point(600 + n2 * sc, 600 + o2 * sc);
W = (D*A*n2 + D*B*o2 - D*B*D*2*PI + D*A*E*2*PI + E*n2*B - E*o2*A + E*A*D*2*PI + E*E*B*2*PI)/(A*A + B*B);
V = (-1*D*n2*B + D*o2*A - D*D*A*2*PI - D*B*E*2*PI + E*A*n2 + E*B*o2 - E*B*D*2*PI + E*E*A*2*PI)/(A*A + B*B);
n2 = 1*(2.7182818284**(W*log(amount)))*cos(V);
o2 = 1*(2.7182818284**(W*log(amount)))*sin(V);
stroke(0,255,255);
point(600 + n2*sc, 600 + o2*sc);
}
//print(o2);
}