Plugins

Plugin reference

Reference for Astrofox plugin manifests, controls, audio data, uniforms, and frames.

Every plugin begins with an astrofox.plugin.json manifest.

Manifest fields#

FieldTypeDescription
apinumberPlugin specification version. Use 1.
namestringRequired namespaced ID such as @author/plugin-name.
versionstringPlugin release version.
labelstringName shown in menus and the Layers panel.
descriptionstringShort explanation shown during installation.
authorstringPlugin author or organization.
typestringdisplay or effect.
runtimestringshader or worker. Displays may use either; effects require shader.
shaderstringFragment shader path for a shader runtime.
entrystringES module path for a worker runtime.
iconstringOptional icon path shown in menus.
permissionsstring[]Requested capabilities, currently including network.
librariesstring[]Host libraries requested by a worker; currently three.
camerabooleanAdds host camera controls to a worker display.
audioobjectFFT and time-domain data requested by the plugin.
defaultPropertiesobjectInitial property values for each new instance.
controlsobjectDeclarative Controls panel schema.
uniformsobjectProperty-to-uniform mapping for shader runtimes.

Paths are resolved relative to the manifest URL. Published files must use HTTPS; http://localhost is allowed for development.

Audio data#

Declare only the audio data the plugin needs:

ValueRange and meaning
fft.bins1–512 normalized frequency values
fft.minFrequency / maxFrequencyFrequency window in hertz
fft.smoothingExponential smoothing from 0–0.99
fft.minDecibels / maxDecibelsInput level normalization bounds
td.samplesNumber of time-domain waveform samples

FFT values arrive from 0 to 1. Time-domain values also range from 0 to 1, with silence centered at 0.5. Worker displays can request both FFT and time-domain data. Shader displays receive FFT and volume only. Shader effects receive volume, time, delta, and inputTexture — not FFT or time-domain arrays. The same analysis path is used during playback and video export.

Controls#

Supported control types are text, number, toggle, checkbox, color, colorrange, range, select, and time.

Common fields include:

FieldPurpose
labelHuman-readable control name
typeInput component to render
min, max, stepNumeric bounds and precision
withRangeShow a slider for a numeric input
withReactorAllow a reactor to drive this property
itemsAvailable values for a select input
hiddenHide the input conditionally or permanently

Because a manifest is JSON, dynamic values use references:

Stage references can include scale; for example, { "$stage": "width", "scale": -1 } resolves to the negative stage width.

Uniform mapping#

Shader runtimes map properties into GLSL uniforms:

color converts a hexadecimal color to a three-component vector. Vector mappings read their components from the listed properties.

Worker factory inputs#

Depending on its manifest, a worker factory receives:

InputDescription
propertiesInitial manifest and instance property values
seedStable per-instance random seed
sizeCurrent stage dimensions
librariesRequested host library namespaces
rendererShared Three.js renderer when three is requested

Frame data#

render(frame) receives:

FieldDescription
idFrame identifier
timeDeterministic time in seconds
deltaTime since the previous frame in milliseconds
playingWhether the timeline or live input is active
exportingWhether an offline export is rendering
volumeOverall normalized audio level
seedStable plugin instance seed
fftRequested FFT array, when configured
tdRequested time-domain array, when configured

During export, delta is fixed to 1000 / fps. Use time, delta, and seed for reproducible animation.

Render result#

A worker render() method may return:

Width and height set the layer bounds. The optional origin values set its transform origin.