📄 export-pipeline.md

← Vault

Export Pipeline

PNG Export

In-Sketch (Keyboard Shortcut)

`javascript

function keyPressed() {

if (key === 's' || key === 'S') {

saveCanvas('output', 'png');

// Downloads output.png immediately

}

}

`

Timed Export (Static Generative)

`javascript

function setup() {

createCanvas(3840, 2160);

pixelDensity(1);

randomSeed(CONFIG.seed);

noiseSeed(CONFIG.seed);

noLoop();

}

function draw() {

// ... render everything ...

saveCanvas('output-seed-' + CONFIG.seed, 'png');

}

`

High-Resolution Export

For resolutions beyond screen size, use pixelDensity() or a large offscreen buffer:

`javascript

function exportHighRes(scale) {

let buffer = createGraphics(width scale, height scale);

buffer.scale(scale);

// Re-render everything to buffer at higher resolution

renderScene(buffer);

buffer.save('highres-output.png');

}

`

Batch Seed Export

`javascript

function exportBatch(startSeed, count) {

for (let i = 0; i < count; i++) {

CONFIG.seed = startSeed + i;

randomSeed(CONFIG.seed);

noiseSeed(CONFIG.seed);

// Render

background(0);

renderScene();

saveCanvas('seed-' + nf(CONFIG.seed, 5), 'png');

}

}

`

GIF Export

saveGif()

`javascript

function keyPressed() {

if (key === 'g' || key === 'G') {

saveGif('output', 5);

// Captures 5 seconds of animation

// Options: saveGif(filename, duration, options)

}

}

// With options

saveGif('output', 5, {

delay: 0, // delay before starting capture (seconds)

units: 'seconds' // or 'frames'

});

`

Limitations:

Platform Export

fxhash Conventions

`javascript

// Replace p5's random with fxhash's deterministic PRNG

const rng = $fx.rand;

// Declare features for rarity/filtering

$fx.features({

'Palette': paletteName,

'Complexity': complexity > 0.7 ? 'High' : 'Low',

'Has Particles': particleCount > 0

});

// Declare on-chain parameters

$fx.params([

{ id: 'density', name: 'Density', type: 'number',

options: { min: 1, max: 100, step: 1 } },

{ id: 'palette', name: 'Palette', type: 'select',

options: { options: ['Warm', 'Cool', 'Mono'] } },

{ id: 'accent', name: 'Accent Color', type: 'color' }

]);

// Read params

let density = $fx.getParam('density');

// Build: npx fxhash build → upload.zip

// Dev: npx fxhash dev → localhost:3300

`

Art Blocks / Generic Platform

`javascript

// Platform provides a hash string

const hash = tokenData.hash; // Art Blocks convention

// Build deterministic PRNG from hash

function prngFromHash(hash) {

let seed = parseInt(hash.slice(0, 16), 16);

// xoshiro128** or similar

return function() { / ... / };

}

const rng = prngFromHash(hash);

`