Skip to content
Josh Stovall edited this page Dec 14, 2020 · 2 revisions

Button()

Create a button, to be used for user interaction.

See the live demo.

Basic Use

var myButton = new XR.Button();

Example

// setup controllers
new XR.Gamepad();

// create a pointer
new XR.Pointer();

// create button
var myButton = new XR.Button({
   text: 'hello world',
   color: 0xFF0000,
   action: buttonAction,
});

// action to execute on button click
function buttonAction(){
   console.log('clicked');
}

Parameters

Name Type Default Description
text string text to display
color color button text color
background color button background color
action function function to trigger when button is clicked
href url make the button a link
borderRadius float button border radius
Clone this wiki locally