From 59e8a984127ca4a5b5440c4d4bae5dfff4ade0ca Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Thu, 3 Jul 2014 12:05:18 -0700 Subject: [PATCH] added example script --- examples/animationStateExample.js | 32 +++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 examples/animationStateExample.js diff --git a/examples/animationStateExample.js b/examples/animationStateExample.js new file mode 100644 index 0000000000..c6987c8626 --- /dev/null +++ b/examples/animationStateExample.js @@ -0,0 +1,32 @@ +// +// animationStateExample.js +// examples +// +// Created by Brad Hefta-Gaub on 7/3/14. +// Copyright 2014 High Fidelity, Inc. +// +// This is an example script that runs in a loop and displays a counter to the log +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// +// + +var count = 0; + +function displayAnimationDetails(deltaTime) { + print("count =" + count + " deltaTime=" + deltaTime); + count++; + var animationDetails = MyAvatar.getAnimationDetailsByRole("idle"); + print("animationDetails.frameIndex=" + animationDetails.frameIndex); +} + +function scriptEnding() { + print("SCRIPT ENDNG!!!\n"); +} + +// register the call back so it fires before each data send +Script.update.connect(displayAnimationDetails); + +// register our scriptEnding callback +Script.scriptEnding.connect(scriptEnding);