0x457ee5f7…eea6sent to0x14578924…b707·#17,880,276·view on Etherscan
var seed = parseInt(tokenData.hash.slice(0, 16), 16);
let projectNumber = Math.floor(parseInt(tokenData.tokenId) / 1000000);
let mintNumber = parseInt(tokenData.tokenId) % 1000000;
p5.disableFriendlyErrors = true;
let rezs = [150, 200, 300];
let cIndex = 1;
let lineThickness;
let lineDepth;
let lineLength;
let lineSpacing;
let depth = 255.0;
let displayRed = true;
let displayGreen = true;
let displayBlue = true;
let stillLifeDim = -1;
let stillLifeDepthNeg = 0;
let stillLifeDepthPos = 0;
let depthScalar = 1.0;
let speedScalar = 1.0;
let speeds = [0.25, 0.5, 1.0, 2.0, 0.0];
let speedIndex = 2;
let SEED = 0;
let lengthScalar = 1.3;
let index = 0;
let laIndex = 771;
let combination = [];
let angle = 0.0;
let alphapix;
let cla, cny, cberlin, ccdmx, clondon, ctokyo;
let s1, s2, s3, s4;
let sc;
let foregrounds = [];
let bColor = 246;
let shapes = [];
let gl;
let stillLifePO2 = 2;
let ext;
let pgl;
let viewDiagram = false;
let viewMatrix;
let modelViewMatrix;
let dispMapTexture;
let CDMXSpin = 1;
const vertCode = `precision highp float;
uniform mat4 uViewMatrix;
uniform mat4 uProjectionMatrix;
uniform mat4 uModelViewMatrix;
uniform mat4 uModelViewProjectionMatrix;
uniform vec2 canvasSize;
uniform float stillLifeDim;
uniform float stillLifePO2;
uniform float stillLifeDepthNeg;
uniform float stillLifeDepthPos;
uniform float depthScalar;
uniform float lineThickness;
uniform float lineDepth;
uniform float lineLength;
uniform vec3 color;
uniform sampler2D displacementMap;
attribute vec3 coordinates;
float map(float value, float min1, float max1, float min2, float max2)
{
return min2 + (value - min1) * (max2 - min2) / (max1 - min1);
}
struct Line
{
vec3 start;
vec3 end;
};
Line getLineFromDisplacementMap(int x_origin, int y_origin)
{
Line l;
vec2 imageCoords = vec2(x_origin, y_origin);
imageCoords.x += .5;
imageCoords.y += .5;
vec2 samplePos = imageCoords.xy/stillLifePO2;
vec4 dispMapColor = texture2D(displacementMap, samplePos);
float maxEdge = max(canvasSize.x, canvasSize.y);
float x = float(x_origin);
float y = float(y_origin);
float z = map(dot(dispMapColor.xyz, color), 0.0, 1.0, -stillLifeDepthNeg, stillLifeDepthPos);
l.start.x = map(x, 0.0, stillLifeDim, -maxEdge / 2.0, maxEdge / 2.0);
l.start.y = map(y, 0.0, stillLifeDim, -maxEdge / 2.0, maxEdge / 2.0);
l.start.z = -z;
l.end.x = map(x, 0.0, stillLifeDim, -maxEdge / 2.0, maxEdge / 2.0) - lineDepth;
l.end.y = map(y, 0.0, stillLifeDim, -maxEdge / 2.0, maxEdge / 2.0) - lineDepth;
l.end.z = -lineLength - z;
return l;
}
void main()
{
bool lineStart = false;
if (coordinates.y == 0.0) lineStart = true;
if (coordinates.y == 1.0) lineStart = true;
if (coordinates.y == 2.0) lineStart = false;
if (coordinates.y == 3.0) lineStart = true;
if (coordinates.y == 4.0) lineStart = false;
if (coordinates.y == 5.0) lineStart = false;
int imageCoordsY = int(floor(coordinates.x / stillLifeDim));
int imageCoordsX = int(floor(coordinates.x - float(imageCoordsY) * stillLifeDim));
Line l = getLineFromDisplacementMap(imageCoordsX, imageCoordsY);
vec3 vertexPosition;
if (lineStart) {
vertexPosition = l.start;
} else {
vertexPosition = l.end;
}
vec4 finalPos = vec4(vertexPosition, 1.0);
finalPos = uModelViewProjectionMatrix * finalPos;
vec4 projLineStart = uModelViewProjectionMatrix * vec4(l.start, 1.0);
vec4 projLineEnd = uModelViewProjectionMatrix * vec4(l.end, 1.0);
vec2 lineDirection = projLineStart.xy - projLineEnd.xy;
lineDirection = vec2(-lineDirection.y, lineDirection.x);
float maxEdge = max(canvasSize.x, canvasSize.y);
lineDirection /= canvasSize / maxEdge;
vec2 displacement = normalize(lineDirection);
displacement /= canvasSize;
displacement *= lineThickness;
if (coordinates.y == 0.0) finalPos.xy -= displacement;
if (coordinates.y == 2.0) finalPos.xy -= displacement;
if (coordinates.y == 5.0) finalPos.xy -= displacement;
if (coordinates.y == 1.0) finalPos.xy += displacement;
if (coordinates.y == 3.0) finalPos.xy += displacement;
if (coordinates.y == 4.0) finalPos.xy += displacement;
finalPos.z = 0.0;
gl_Position = finalPos;
}
`;
const fragCode = `precision highp float;
uniform vec3 color;
void main() {
gl_FragColor = vec4(color, 1.0);
}
`;
let triangle_buffer;
let numTris;
function setupGeometry() {
let triangles = [];
numTris = 0;
for (let y = 0; y < rezs[cIndex]; y += 1) {
for (let x = 0; x < rezs[cIndex]; x += 1) {
triangles.push(x + y * stillLifeDim, 0, 0);
triangles.push(x + y * stillLifeDim, 1, 0);
triangles.push(x + y * stillLifeDim, 2, 0);
triangles.push(x + y * stillLifeDim, 3, 0);
triangles.push(x + y * stillLifeDim, 4, 0);
triangles.push(x + y * stillLifeDim, 5, 0);
numTris += 6;
}
}
triangle_buffer = gl.createBuffer();
gl.bindBuffer(gl.ARRAY_BUFFER, triangle_buffer);
gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(triangles), gl.STATIC_DRAW);
gl.bindBuffer(gl.ARRAY_BUFFER, null);
}
function setupShapes() {
let sss = 0.72;
shapes = [];
for (let i = 0; i < combination.length; i++) {
shapes.push(
new VShape(
-stillLifeDim / 2,
-stillLifeDim / 2,
stillLifeDim * sss,
combination[i]
)
);
}
theDetails();
}
function theDetails() {
let maxSide = max(width, height);
if (maxSide < 400) {
depthScalar = map(maxSide, 50, 400, 0.05, 0.3);
} else {
depthScalar = map(maxSide, 400, 3840, 0.3, 2.0);
}
stillLifeDepthNeg = 255.0;
stillLifeDepthPos = 255.0;
lengthScalar = 1.0;
if (index < 155) {
tokyoParams();
} else if (index < 309) {
berlinParams();
} else if (index < 463) {
londonParams();
} else if (index < 617) {
nycParams();
} else if (index < laIndex) {
cdmxParams();
} else {
laParams();
}
}
let shaderProgram;
function setupShaders() {
let vertShader = gl.createShader(gl.VERTEX_SHADER);
gl.shaderSource(vertShader, vertCode);
gl.compileShader(vertShader);
const vertError = gl.getShaderInfoLog(vertShader);
if (vertError.length > 0) {
throw vertError;
}
let fragShader = gl.createShader(gl.FRAGMENT_SHADER);
gl.shaderSource(fragShader, fragCode);
gl.compileShader(fragShader);
const fragError = gl.getShaderInfoLog(fragShader);
if (fragError.length > 0) {
throw fragError;
}
shaderProgram = gl.createProgram();
gl.attachShader(shaderProgram, vertShader);
gl.attachShader(shaderProgram, fragShader);
gl.linkProgram(shaderProgram);
}
function createDisplacementMapTexture() {
dispMapTexture = gl.createTexture();
while (stillLifePO2 < stillLifeDim) {
stillLifePO2 *= 2;
}
}
function transferDisplacementMap() {
let img = alphapix.get();
img.loadPixels();
let uvTexture = Array(stillLifePO2 * stillLifePO2 * 4).fill(255);
const randomStuff = new Uint8Array(uvTexture);
for (let x = 0; x < stillLifeDim; ++x) {
for (let y = 0; y < stillLifeDim; ++y) {
const index1 = 4 * (y * stillLifePO2 + x);
const index2 = 4 * (y * stillLifeDim + x);
randomStuff[index1 + 0] = img.pixels[index2 + 0];
randomStuff[index1 + 1] = img.pixels[index2 + 1];
randomStuff[index1 + 2] = img.pixels[index2 + 2];
}
}
gl.bindTexture(gl.TEXTURE_2D, dispMapTexture);
gl.texImage2D(
gl.TEXTURE_2D,
0,
gl.RGBA,
stillLifePO2,
stillLifePO2,
0,
gl.RGBA,
gl.UNSIGNED_BYTE,
randomStuff
);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);
gl.bindTexture(gl.TEXTURE_2D, null);
gl.activeTexture(gl.TEXTURE2);
gl.bindTexture(gl.TEXTURE_2D, dispMapTexture);
const displaceMapLocation = gl.getUniformLocation(
shaderProgram,
"displacementMap"
);
gl.uniform1i(displaceMapLocation, 2);
}
function setMatrices() {
const viewMatrix = this._renderer._curCamera.cameraMatrix;
const projectionMatrix = this._renderer.uPMatrix;
const modelViewMatrix = this._renderer.uMVMatrix;
const modelViewProjectionMatrix = modelViewMatrix.copy();
modelViewProjectionMatrix.mult(projectionMatrix);
gl.uniformMatrix4fv(
gl.getUniformLocation(shaderProgram, "uViewMatrix"),
false,
viewMatrix.mat4
);
gl.uniformMatrix4fv(
gl.getUniformLocation(shaderProgram, "uProjectionMatrix"),
false,
projectionMatrix.mat4
);
gl.uniformMatrix4fv(
gl.getUniformLocation(shaderProgram, "uModelViewMatrix"),
false,
modelViewMatrix.mat4
);
gl.uniformMatrix4fv(
gl.getUniformLocation(shaderProgram, "uModelViewProjectionMatrix"),
false,
modelViewProjectionMatrix.mat4
);
}
function setUniforms() {
gl.uniform2f(
gl.getUniformLocation(shaderProgram, "canvasSize"),
width,
height
);
gl.uniform1f(
gl.getUniformLocation(shaderProgram, "stillLifeDim"),
stillLifeDim
);
gl.uniform1f(
gl.getUniformLocation(shaderProgram, "stillLifePO2"),
stillLifePO2
);
gl.uniform1f(
gl.getUniformLocation(shaderProgram, "depthScalar"),
depthScalar
);
gl.uniform1f(
gl.getUniformLocation(shaderProgram, "stillLifeDepthNeg"),
stillLifeDepthNeg * depthScalar
);
gl.uniform1f(
gl.getUniformLocation(shaderProgram, "stillLifeDepthPos"),
stillLifeDepthPos * depthScalar
);
gl.uniform1f(
gl.getUniformLocation(shaderProgram, "lineThickness"),
lineThickness
);
gl.uniform1f(gl.getUniformLocation(shaderProgram, "lineLength"), lineLength);
gl.uniform1f(gl.getUniformLocation(shaderProgram, "lineDepth"), lineDepth);
}
function beginLinesShader() {
gl.useProgram(shaderProgram);
gl.bindBuffer(gl.ARRAY_BUFFER, triangle_buffer);
transferDisplacementMap();
setUniforms();
const coord = gl.getAttribLocation(shaderProgram, "coordinates");
gl.vertexAttribPointer(coord, 3, gl.FLOAT, false, 0, 0);
gl.enableVertexAttribArray(coord);
gl.enable(gl.BLEND);
gl.disable(gl.DEPTH_TEST);
gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
gl.viewport(0, 0, canvas.width, canvas.height);
}
function endLinesShader() {
gl.useProgram(null);
}
function drawLines() {
beginLinesShader();
setMatrices();
gl.uniform3f(gl.getUniformLocation(shaderProgram, "color"), 1, 0, 0);
if (displayRed) {
gl.drawArrays(gl.TRIANGLES, 0, numTris);
}
translate(lineSpacing, 0.0, 0.1);
setMatrices();
gl.uniform3f(gl.getUniformLocation(shaderProgram, "color"), 0, 1, 0);
if (displayGreen) {
gl.drawArrays(gl.TRIANGLES, 0, numTris);
}
translate(lineSpacing, 0.0, 0.1);
setMatrices();
gl.uniform3f(gl.getUniformLocation(shaderProgram, "color"), 0, 0, 1);
if (displayBlue) {
gl.drawArrays(gl.TRIANGLES, 0, numTris);
}
endLinesShader();
}
function setupTransform() {
ortho();
scale(1.45);
rotateY(0.33);
rotateX(-0.33);
}
function setupCombination(code) {
combination = [];
let comb = str(code);
for (let i = 0; i < comb.length; i++) {
let char = comb[i];
if (char != "0") {
let c = int(comb[i]) - 1;
combination.push(c);
}
}
}
function defineColors() {
let aaa = 254;
ctokyo = color(227, 143, 53, aaa); // Orange
cberlin = color(53, 155, 227, aaa); // Blue
clondon = color(231, 71, 71, aaa); // Red
cny = color(166, 79, 206, aaa); // Lavender
ccdmx = color(76, 205, 82, aaa); // Green
cla = color(238, 211, 30, aaa); // Yellow
foregrounds = [ctokyo, cberlin, clondon, cny, ccdmx, cla];
s1 = color(255, 226, 204);
s2 = color(204, 255, 226);
s3 = color(225, 204, 226);
s4 = color(164, 204, 255);
sc = [s1, s2, s3, s4];
}
function windowResized() {
resizeCanvas(windowWidth, windowHeight);
theDetails();
}
function setup() {
createCanvas(windowWidth, windowHeight, WEBGL);
r = new RND(seed);
defineRez();
if (mintNumber >= 924) {
index = int(random(0, 924));
} else {
index = mintNumber;
}
defineColors();
imageMode(CENTER);
gl = document.getElementById("defaultCanvas0").getContext("webgl");
stillLifeDim = rezs[cIndex];
alphapix = createGraphics(stillLifeDim, stillLifeDim, WEBGL);
pgl = alphapix._renderer.GL;
pgl.disable(gl.DEPTH_TEST);
setupShaders();
doIt();
}
function defineRez() {
cIndex = 1;
}
function doIt() {
stillLifeDim = rezs[cIndex];
alphapix.resizeCanvas(stillLifeDim, stillLifeDim);
setupCombination(allCombinations[index]);
setupShapes();
setupGeometry();
createDisplacementMapTexture();
createStillLife();
}
function createGround() {
if (speedIndex != 4) {
angle += 0.0005;
}
let ss = map(sin(angle), -1, 1, 0, 1);
let c1 = lerpColor(sc[0], sc[1], ss);
let c2 = lerpColor(sc[1], sc[2], ss);
let c3 = lerpColor(sc[2], sc[3], ss);
let c4 = lerpColor(sc[3], sc[1], ss);
alphapix.background(255);
alphapix.blendMode(BLEND);
alphapix.beginShape();
alphapix.fill(c1);
alphapix.vertex(-alphapix.width/2, -alphapix.height/2);
alphapix.fill(c2);
alphapix.vertex(alphapix.width/2, -alphapix.height/2);
alphapix.fill(c3);
alphapix.vertex(alphapix.width/2, alphapix.height/2);
alphapix.fill(c4);
alphapix.vertex(-alphapix.width/2, alphapix.height/2);
alphapix.endShape();
}
function createStillLife() {
createGround();
alphapix.blendMode(MULTIPLY);
for (let i = 0; i < shapes.length; i++) {
shapes[i].move();
shapes[i].display(alphapix);
}
}
function draw() {
let scaleFactor = max(width, height) / 1200.0;
if (cIndex == 2) {
lineThickness = 1.66 * scaleFactor;
lineLength = 3.0 * lengthScalar * scaleFactor;
} else if (cIndex == 0) {
lineThickness = 3.33 * scaleFactor;
lineLength = 8.0 * lengthScalar * scaleFactor;
} else {
lineThickness = 2.22 * scaleFactor;
lineLength = 12.0 * lengthScalar * scaleFactor;
}
lineDepth = 2 * scaleFactor;
lineSpacing = 2.22 * scaleFactor;
createStillLife();
background(bColor);
push();
setupTransform();
drawLines();
pop();
if (viewDiagram) {
fill(255);
noStroke();
rect(0, 0, -stillLifeDim/2, -stillLifeDim/2);
image(alphapix, 0, 0);
}
if (speedIndex != 4) {
CDMXSpin++;
}
}
class VShape {
constructor(xin, yin, uin, win) {
this.scale = 1.0;
this.targetScale = 1.0;
this.scaleStep = 0.2;
this.dia = uin * 0.75;
this.mdia = uin * 0.8;
this.rdia = uin * 0.66;
this.ddia = uin * 0.55;
this.tdia = uin * 0.8;
this.tdia2 = uin * 0.7;
this.hu = uin * 0.5;
this.qr1 = uin * 0.3;
this.qr2 = uin * 0.2;
this.sr = uin * 0.4;
this.x = xin;
this.y = yin;
this.unit = stillLifeDim;
this.rx = this.x + (this.unit - this.rdia) / 2;
this.ry = this.y + (this.unit - this.rdia) / 2;
this.cx = this.x + this.unit / 2;
this.cy = this.y + this.unit / 2;
this.cindex = win;
this.sindex = win;
this.movex = 0;
this.movey = 0;
this.hexx = uin * 0.2;
this.hexy = uin * 0.346;
this.moonAngle = r.rb(0, TWO_PI);
this.moveyval = r.rb(0.0005, 0.002);
this.movexval = r.rb(0.0005, 0.002);
if (r.rb(1) > 0.5) {
this.moveyval *= -1;
}
if (r.rb(1) > 0.5) {
this.movexval *= -1;
}
}
resetScale() {
this.targetScale = 1.0;
}
upScale() {
this.targetScale += this.scaleStep;
}
downScale() {
this.targetScale -= this.scaleStep;
this.targetScale = max(0.0, this.targetScale);
}
move() {
this.movex += this.movexval * speedScalar;
this.movey += this.moveyval * speedScalar;
this.scale = (this.targetScale - this.scale) * 0.05 + this.scale;
}
display(pg) {
if (this.sindex == 0) {
this.sTokyo(pg);
} else if (this.sindex == 1) {
this.sBerlin(pg);
} else if (this.sindex == 2) {
this.sLondon(pg);
} else if (this.sindex == 3) {
this.sNYC(pg);
} else if (this.sindex == 4) {
this.sCDMX(pg);
} else if (this.sindex == 5) {
this.sLA(pg);
}
}
sTokyo(pg) {
pg.noStroke();
pg.push();
pg.scale(this.scale);
pg.translate(this.cx, this.cy);
pg.rotateY(this.movey);
pg.rotateX(this.movex);
pg.fill(foregrounds[this.cindex]);
pg.ellipse(0, 0, this.dia, this.dia);
pg.pop();
}
sBerlin(pg) {
pg.noStroke();
pg.fill(foregrounds[this.cindex]);
pg.push();
pg.scale(this.scale);
pg.beginShape();
pg.translate(this.cx, this.cy);
pg.rotateX(this.movex);
pg.rotateY(this.movey);
pg.vertex(-this.qr1, -this.hu);
pg.vertex(this.qr1, -this.qr2);
pg.vertex(this.qr1, this.hu);
pg.vertex(-this.qr1, this.qr2);
pg.endShape();
pg.pop();
}
sLondon(pg) {
pg.push();
pg.scale(this.scale);
pg.translate(this.rx + this.rdia / 2, this.ry + this.rdia / 2);
pg.rotateY(this.movey);
pg.rotateX(this.movex);
pg.noStroke();
pg.fill(foregrounds[this.cindex]);
pg.beginShape();
pg.vertex(-this.rdia / 2, -this.rdia / 2);
pg.vertex(this.rdia / 2, -this.rdia / 2);
pg.vertex(this.rdia / 2, this.rdia / 2);
pg.vertex(-this.rdia / 2, this.rdia / 2);
pg.endShape();
pg.pop();
}
sNYC(pg) {
pg.push();
pg.scale(this.scale);
pg.translate(this.rx + this.rdia / 2, this.ry + this.rdia / 2);
pg.rotateY(this.movey);
pg.rotateX(this.movex);
pg.noStroke();
pg.fill(foregrounds[this.cindex]);
pg.beginShape();
pg.vertex(this.hexx, -this.hexy);
pg.vertex(this.hexx*2, 0);
pg.vertex(this.hexx, this.hexy);
pg.vertex(-this.hexx, this.hexy);
pg.vertex(-this.hexx*2, 0);
pg.vertex(-this.hexx, -this.hexy);
pg.endShape();
pg.pop();
}
sCDMX(pg) {
pg.push();
pg.scale(this.scale);
pg.translate(this.rx + this.rdia / 2, this.ry + this.rdia / 2.66);
pg.rotateY(this.movey);
pg.rotateX(this.movex);
pg.rotateZ(CDMXSpin/1000.0);
pg.noStroke();
pg.fill(foregrounds[this.cindex]);
pg.beginShape();
pg.vertex(0, -this.tdia / 2);
pg.vertex(this.tdia / 2, this.tdia2 / 2);
pg.vertex(-this.tdia / 2, this.tdia2 / 2);
pg.endShape();
pg.pop();
}
sLA(pg) {
pg.noStroke();
pg.fill(foregrounds[this.cindex]);
pg.push();
pg.scale(this.scale);
pg.translate(this.cx, this.cy);
pg.rotate(this.moonAngle);
pg.rotateX(this.movex);
pg.rotateY(this.movey);
pg.rotateZ(CDMXSpin/1000.0);
pg.arc(0, 0, this.mdia, this.mdia, 0.7, TWO_PI - 0.7, CHORD);
pg.pop();
}
}
function tokyoParams() {
displayRed = true;
displayGreen = true;
displayBlue = true;
bColor = 246;
lengthScalar = 0.8;
}
function berlinParams() {
displayRed = false;
displayGreen = true;
displayBlue = true;
bColor = 15;
lengthScalar = 0.5;
if (index === 155) {
stillLifeDepthNeg = 350.0;
stillLifeDepthPos = 150.0;
}
}
function londonParams() {
displayRed = true;
displayGreen = false;
displayBlue = true;
bColor = 246;
lengthScalar = 0.5;
}
function nycParams() {
displayRed = false;
displayGreen = false;
displayBlue = true;
bColor = 246;
lengthScalar = 0.7;
if (index === 463) {
stillLifeDepthNeg = 400.0;
stillLifeDepthPos = 100.0;
}
}
function cdmxParams() {
displayRed = false;
displayGreen = true;
displayBlue = false;
bColor = 51;
lengthScalar = 0.7;
if (index === 617) {
stillLifeDepthNeg = 500.0;
stillLifeDepthPos = 0.0;
}
}
function laParams() {
displayRed = true;
displayGreen = true;
displayBlue = true;
bColor = 26;
lengthScalar = 0.8;
}
function keyPressed() {
if (key == '=' || key == '+') {
for (let i = 0; i < shapes.length; i++) {
shapes[i].upScale();
}
} else if (key == '-' || key == '_') {
for (let i = 0; i < shapes.length; i++) {
shapes[i].downScale();
}
} else if (key == 'd' || key == 'D') {
viewDiagram = !viewDiagram;
} else if (key == ' ') {
bColor -= 26;
if (bColor <= 0) {
bColor = 255;
}
} else if (key == 'r' || key == 'R') {
displayRed = !displayRed;
} else if (key == 'g' || key == 'G') {
displayGreen = !displayGreen;
} else if (key == 'b' || key == 'B'){
displayBlue = !displayBlue;
} else if (key == '1') {
tokyoParams();
} else if (key == '2') {
berlinParams();
} else if (key == '3') {
londonParams();
} else if (key == '4') {
nycParams();
} else if (key == '5') {
cdmxParams();
} else if (key == '6') {
laParams();
} else if (keyCode == UP_ARROW) {
stillLifeDepthNeg += 26;
stillLifeDepthPos += 26;
} else if (keyCode == DOWN_ARROW) {
stillLifeDepthNeg -= 26;
stillLifeDepthPos -= 26;
} else if (key == 's' || key == 'S') {
speedIndex++;
speedIndex = speedIndex % speeds.length;
speedScalar = speeds[speedIndex];
} else if (key == '0') {
lengthScalar += 0.2;
} else if (key == '9') {
if (lengthScalar > 0.4) {
lengthScalar -= 0.2;
}
} else if (key == 't' || key == 'T') {
cIndex++;
if (cIndex >= rezs.length) {
cIndex = 0;
}
doIt();
} else if (key == 'p' || key == 'P') {
saveCanvas(nf(index,3) + '-' + allCombinations[index] + "-" + frameCount + ".png", 0, 0, width, height);
}
}
class RND {
constructor(seed) {
this.seed = seed;
}
rd() {
this.seed ^= this.seed << 13;
this.seed ^= this.seed >> 17;
this.seed ^= this.seed << 5;
return ((this.seed < 0 ? ~this.seed + 1 : this.seed) % 1000) / 1000;
}
rb(a, b) {
return a + (b - a) * this.rd();
}
}