beta
cables is under heavy development.
There might be one or another bug, please let us know about it!
cables DocumentationHow To UseWorking with filesKeyboard ShortcutsUser Interface WalkthroughBeginner TutorialBeginner 1: Drawing A CircleBeginner 2: TransformationsBeginner 3: ColorMore TransformationsintermediateImage CompositionsPost-Processing 3D Scenescommunicationcables APIExporting and EmbeddingHow to serve files externally and fix CORS headersExporting PatchesExport using the cables command line interfaceExport via IframeExport creating a standalone executableExport to github (pages)Export and deploy to netlifyExport a ZIP fileExternal triggers / functionsUsing variablesPreviewing / uploading exported cables patchescoding opsCreating AttachmentsGeneral op/Port CallbacksPortsDynamic PortsArray PortsBoolean portsInteger Number PortsObject PortsString portsTrigger PortsFloating Point Number PortsGUI/UI attributesHello Op - Part 1LibrariesDeveloping OpsGuidelinesObject PortsWriting ShadersWeb Audio Op DevelopmentHTML and CSS in cablesLightingLightsShadowsWorking with audioBasic Audio SetupWorking with EffectsReal-Time Audio Analyzation & Audio VisualizationOffline Audio Visualization & AnalyzationOptimizing Performance in PatchesTools for debugging your patchHow to optimize cables patches with the Performance opHow to optimize cables patches with the ProfilerCommon pitfalls with the "usual suspects"Optimizing arraysDebugging Shaders with ShaderInfoFAQAudio in web browsersEmbeddingHow to integrate my cables patch into my CMS (webflow/wix/squarespace/...)?getting a warning when running the patch in electronHow to remove grey rectangles on touch (mobile)?Why doesn't the DownloadTexture op work on iOS?How to disable page scrolling on mobile?Mobile tippsHow to run exported patches on your local machineTransparent CanvasFeatures and SupportHow to contribute code to cablesWill there be support for (animated) GIFs?Screenshots and Video recordingHow to report a bug in cableshow can I support cables?Video playback in cablesGeneral questionsLicences and paymentWhat licence do i need to use cables?Will I have to pay for it in the future?How is my work licenced when using cables?Does cables support midi and OSC?My User Profile & Social MediaShadertoyTechnical questionsGuide to VR in cablesWebGL1 and WebGL2

GUI/UI attributes

Group Ports

to bundle ports into groups and set a visual divider between them:

op.setPortGroup('Display',[portScale,portFont]);
op.setPortGroup('Alignment',[portAlign,portVAlign]);
op.setPortGroup('Color',[r,g,b,a]);

Hide port

To hide a port on a op but still have a UI element use the following code

portName.setUiAttribs({ "hidePort": true });

Warnings and Errors

Ui attributes of an op can be set to give the user warnings and give visual feedback about things that may require their attention.

To do this use the following format:

if(condition) op.setUiError("errorID", "error ID/must be unique per error","Error message to show in UI",0);
// this resets the error message so it disappears
else op.setUiError("errorID",null);

The number in the last part of the function defines what kind of error is shown
0 - hint / grey color
1 - warning / orange color
2 - error / red color / this will also place a red dot on the right hand side of the op


Button


example code to show an error:

// create a port of the type boolean
const switch1=op.inBool("Error",false);
// if port changes run this function
switch1.onChange=function()
{
    if(switch1.get()) op.setUiError("error1","switch 1 is true",2);
    else op.setUiError("error1",null);
}

help cables get better and edit this file on github