var gB, fullRes, windowRes;
var requiredFrames = 120;
var glyphQuantityH, glyphQuantityV, glyphComplexity, glyphSize;
windowRes = min(windowWidth, windowHeight);
createCanvas(windowRes, windowRes);
gB = createGraphics(fullRes = 1024, fullRes);
gB.translate(fullRes * 0.5, fullRes * 0.5);
var animationProgress = (frameCount / requiredFrames) % 1;
for (var k = 0; k < glyphQuantityH; k += 1) {
for (var l = 0; l < glyphQuantityV; l += 1) {
for (var i = 0; i < glyphComplexity + floor(random(2)); i += 1) {
for (var j = 0; j < glyphComplexity; j += 1) {
writing[k][l][i][j] = [random() * random(), random() * random()];
glyphSize = fullRes / min(glyphQuantityH, glyphQuantityV);
for (eachLine in writing) {
gB.translate(0, map(eachLine, 0, glyphQuantityH, fullRes * -0.425, fullRes * 0.425), 0);
gB.stroke(240, 180, 360, 60);
gB.line(fullRes * 0.45, glyphSize * 2 * random(0.9, 1.1), fullRes * -0.45, glyphSize * 2 * random(0.9, 1.1));
for (eachGlyph in writing[eachLine]) {
gB.translate(map(eachGlyph, 0, glyphQuantityV, fullRes * -0.45, fullRes * 0.45), 0);
gB.translate(random(-glyphSize, glyphSize), random(-glyphSize, glyphSize) * 0.25);
var thisGlyph = writing[eachLine][eachGlyph];
gB.strokeWeight(random(0.9, 1.1));
for (var i = 0; i < thisGlyph.length; i += 1) {
for (var j = 0; j < glyphComplexity; j += 1) {
gB.curveVertex(thisGlyph[i][j][0] * glyphSize * random(0.9, 1.1), thisGlyph[i][j][1] * glyphSize * random(0.9, 1.1));
function mouseClicked() {
glyphQuantityH = 1 + floor(random(48));
glyphQuantityV = 1 + floor(random(48));
glyphComplexity = 1 + floor(random(4));
saveGif('export', requiredFrames, {
function displayBuffer(buffer) {
image(buffer, windowRes / 2, windowRes / 2, windowRes, windowRes);
function windowResized() {
windowRes = min(windowWidth, windowHeight);
resizeCanvas(windowRes, windowRes);