cables.gl operators are programmable in JavaScript with typed ports, extending the patch beyond the built-in op library
Beyond the built-in ops, cables.gl lets users write custom operators in JavaScript. A custom op declares its ports — typed as float, integer, boolean, string, object, array, or trigger — and implements callbacks that fire when an input value changes or when a frame renders. Custom ops integrate identically to built-in ones: they appear in the op library, connect through the same cable system, and are shareable across patches. This creates a programmability gradient from no-code patching, through SubPatchOps (which encapsulate a sub-patch as a reusable op without code), up to full custom JavaScript ops — including ops that embed GLSL shader code or drive the browser’s Web Audio API. That gradient is what makes cables.gl usable both as a beginner patching tool and as a platform for building bespoke WebGL visual instruments.
Examples
A custom op takes a float ‘speed’ input and outputs a time-varying value each frame, feeding a mesh’s scale port. A shader op implements a feedback blur in GLSL; a Web Audio op exposes an audio effect. A SubPatchOp bundles a reusable sub-patch with no JavaScript at all.
Assessment
List the port types available to cables.gl custom ops. Sketch the skeleton of a custom op that takes a float ‘speed’ input and emits a time-varying value. When would you reach for a SubPatchOp instead of a JavaScript op?