content/hifi-content/wadewatts/Button Hand Raise/app- hand raise animation button pause 1.js
2022-02-14 02:04:11 +01:00

28 lines
1.1 KiB
JavaScript

//Hand Raise 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/hand%20raise%20off%201.svg",
activeIcon: "https://hifi-content.s3.amazonaws.com/wadewatts/Button%20Hand%20Raise/hand%20raise%20on%201.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); });