28 lines
1.1 KiB
JavaScript
28 lines
1.1 KiB
JavaScript
|
|
//Raise Hand Animation Button
|
|
var URL = 'https://hifi-content.s3.amazonaws.com/wadewatts/Button%20Hand%20Raise/M_SpaMar_hand_raise.fbx';
|
|
var CONFIG = {
|
|
text: 'Raise',
|
|
icon: "https://hifi-content.s3.amazonaws.com/wadewatts/Button%20Hand%20Raise/raise%20hand%20button%20off.svg",
|
|
activeIcon: "https://hifi-content.s3.amazonaws.com/wadewatts/Button%20Hand%20Raise/raise%20hand%20button%20on.svg"
|
|
};
|
|
|
|
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system"),
|
|
button = tablet.addButton(CONFIG);
|
|
function raiseHand(url, fps) { fps=fps||30; MyAvatar.overrideAnimation(url, fps, false, 1, 84); Script.setTimeout(function(){ MyAvatar.overrideAnimation(url, 5, true, 32, 42); }, 84/fps*1000); }
|
|
|
|
button.clicked.connect(function() {
|
|
this.a = !this.a;
|
|
button.editProperties({ isActive: this.a });
|
|
|
|
if (this.a)
|
|
raiseHand(URL,30);
|
|
|
|
|
|
else
|
|
MyAvatar.restoreAnimation();
|
|
|
|
});
|
|
|
|
|
|
Script.scriptEnding.connect(function() { tablet.removeButton(button); });
|