-
Notifications
You must be signed in to change notification settings - Fork 1
Button
Josh Stovall edited this page Dec 14, 2020
·
2 revisions
Create a button, to be used for user interaction.
See the live demo.
var myButton = new XR.Button();
// 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');
}
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 |