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 APICommunication with an Arduino via SerialCommunicating with Arduino over MQTTExporting 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 & AnalyzationFAQEmbeddingHow 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 tippsTransparent CanvasFeatures and SupportHow to contribute code to cablesWill there be support for (animated) GIFs?How to report a bug 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?ShadertoyTechnical questionsUI / EditorGuide 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.hidePort();

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.


The following example will give an error in the OP UI and show a red circle if the value coming in is above 1.0


Button

If the value is lower than 0 then the UI will show this message
Button

//create a port for value input
const inVal  = op.inFloat ("Value in");
//create a port for value output
const outVal = op.outNumber("value out");

//when inVal changes run this function
inVal.onChange = function()
{

    if(inVal.get() > 1.0)
    {
        //this causes the op to show a red circle
        //and show "There's an error" in the op UI
        op.uiAttr({ error :"There's an error"});
    }
    else
    {
        //clear the UI 
        op.uiAttr({ error : null });
    }
    if(inVal.get() < 0.0)
    {
        //if value in is below 0.0 the following message is displayed 
        //in the UI
        op.uiAttr({ warning :"There's a problem, value is below 0.0"});
    }
    else
    {
        //clear the UI 
        op.uiAttr({ warning : null });
    }
};

help cables get better and edit this file on github