API Documentation

for 0.0.1
Show:

Button Class

A Button is a special kind of 3D object that is clickable and that you can use to build Graphical User Interfaces (GUI).

Constructor

Button

(
  • params
)

Parameters:

  • params Object

    parameters object.

    • camera Camera

      the camera used for picking.

    • text String

      text to render (can be empty).

    • textSize Number

      the text size

    • font Object

      font to use.

    • width Number

      width in pixels.

    • height Number

      height in pixels.

    • canvasWidth Number

      canvasWidth in pixels.

    • canvasHeight Number

      canvasHeight in pixels.

    • cutOff Number

      the size of the cutOff

    • strokeColor Color
    • fillColor Color
    • pressFillColor Color
    • hoverFillColor Color
    • [onPress] Function optional
    • [onRelease] Function optional
    • [onEnter] Function optional
    • [onLeave] Function optional
    • [fontURL] URL optional

      url for the regular font file

    • [fontItalicURL] URL optional

      url for the italic font file

    • [fontBoldURL] URL optional

      url for the bold font file

    • [fontBoldItalicURL] URL optional

      url for the bold-italic font file

Example:

//TODO

Methods

adaptCorner

(
  • mode
  • corner
)

Adapt a corner of the shape, for grouping buttons together

Parameters:

  • mode String

    cutOff, straight

  • corner String

    topLeft, topRight, bottomRight,bottomLeft

fakePress

()

Can be used to simulate a pressed event when necessary (i.e. when a keyboard event should modify the button state).

generateDefaultMesh

() private

Generate the vertices and meshes for the default button. Called internally only

off

()

deactivate the button, set its opacity to 30 %

on

()

Activate the button

regenerateStrokeGeometry

(
  • the
)
private

regenerate the geometry of the mesh for further update

Parameters:

  • the Mesh

    mesh to regenerate the stroke for