Class UiPanelJsonConfig

Constructors

Properties

children: (Controller | UiPanelJsonConfig)[] = []
expanded?: boolean
hidden?: boolean
isFolder?: boolean
title?: string

Methods

  • Adds a controller to the GUI, inferring controller type using the typeof operator.

    Parameters

    • object: object

      The object the controller will modify.

    • property: string

      Name of the property to control.

    • Optional values: number | object | any[]

      Minimum value for number controllers, or the set of selectable values for a dropdown.

    • Optional max: number

      Maximum value for number controllers.

    • Optional step: number

      Step value for number controllers.

    Returns Controller

    Example

    gui.add( object, 'property' );
    gui.add( object, 'number', 0, 100, 1 );
    gui.add( object, 'options', [ 1, 2, 3 ] );
  • Parameters

    • object: object
    • property: string
    • Optional opt_params: {
          label?: string;
          max?: number;
          min?: number;
          options?: object | any[];
          step?: number;
          type?: string;
          view?: string;
      }
      • Optional label?: string
      • Optional max?: number
      • Optional min?: number
      • Optional options?: object | any[]
      • Optional step?: number
      • Optional type?: string
      • Optional view?: string

    Returns Controller

  • 增加一个按钮

    Parameters

    • title: string

      Name to display in the folder's title bar.

    • cb: Function

    Returns Controller

    Example

    gui.addButton( "测试", () => console.log(1) );
    
  • Adds a color controller to the GUI.

    Parameters

    • object: object

      The object the controller will modify.

    • property: string

      Name of the property to control.

    Returns Controller

    Example

    params = {
    cssColor: '#ff00ff',
    rgbColor: { r: 0, g: 0.2, b: 0.4 },
    customRange: [ 0, 127, 255 ],
    };

    gui.addColor( params, 'cssColor' );
    gui.addColor( params, 'rgbColor' );
    gui.addColor( params, 'customRange', 255 );
  • Adds a folder to the GUI, which is just another GUI. This method returns the nested GUI so you can add controllers to it.

    Parameters

    • title: string | {
          expanded?: boolean;
          title: string;
      }

      Name to display in the folder's title bar.

    Returns UiPanelJsonConfig

    Example

    const folder = gui.addFolder( 'Position' );
    folder.add( position, 'x' );
    folder.add( position, 'y' );
    folder.add( position, 'z' );
  • 增加一个函数

    Parameters

    • cb: Function

    Returns void

  • Opens a GUI or folder. GUI and folders are open by default.

    Parameters

    • Optional open: boolean

      Pass false to close

    Returns this

    Example

    gui.open(); // open
    gui.open( false ); // close
    gui.open( gui._closed ); // toggle
  • Shows the GUI after it's been hidden.

    Parameters

    • Optional show: boolean

    Returns this

    Example

    gui.show();
    gui.show( false ); // hide
    gui.show( gui._hidden ); // toggle
  • Returns any