From e39df5fdbaf86b7a249c3f058eb63578393a387f Mon Sep 17 00:00:00 2001 From: ericrius1 Date: Wed, 16 Mar 2016 15:54:29 -0700 Subject: [PATCH] number of frames on cuckoo animation is high --- .../cuckooClockMinuteHandEntityScript.js | 26 ++++++++++++++++--- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/unpublishedScripts/DomainContent/Home/cuckooClock/cuckooClockMinuteHandEntityScript.js b/unpublishedScripts/DomainContent/Home/cuckooClock/cuckooClockMinuteHandEntityScript.js index 67751b9626..04ddca0065 100644 --- a/unpublishedScripts/DomainContent/Home/cuckooClock/cuckooClockMinuteHandEntityScript.js +++ b/unpublishedScripts/DomainContent/Home/cuckooClock/cuckooClockMinuteHandEntityScript.js @@ -16,13 +16,31 @@ preload: function(entityID) { _this.entityID = entityID; // this.animation.isRunning = true; - var userData = getEntityUserData(entityID); - var clockBody = userData.clockBody; + _this.userData = getEntityUserData(entityID); // print("ANIMATION!!! " + JSON.stringify(_this.animationURL)); - Entities.editEntity(_this.entityID, {animation: {running: true}}) - + if (!_this.userData || !_this.userData.clockBody) { + print("THIS CLOCK HAND IS NOT ATTACHED TO A CLOCK BODY!"); + return; + } + _this.clockBody = _this.userData.clockBody; + Entities.editEntity(_this.clockBody, {animation: {running: true}}); + Script.update.connect(_this.update); }, + unload: function() { + Script.update.disconnect(_this.update); + }, + + + update: function() { + _this.clockBodyAnimationProps = Entities.getEntityProperties(_this.clockBody, "animation").animation; + if (!_this.clockBodyAnimationProps) { + print("NO CLOCK BODY ANIMATION PROPS! RETURNING"); + return; + } + print("current Frame " + _this.clockBodyAnimationProps.currentFrame); + } + };