diff --git a/unpublishedScripts/marketplace/audienceApplauseMeter/bakedTextMeter.js b/unpublishedScripts/marketplace/audienceApplauseMeter/bakedTextMeter.js index 9dc56620ef..021429618e 100644 --- a/unpublishedScripts/marketplace/audienceApplauseMeter/bakedTextMeter.js +++ b/unpublishedScripts/marketplace/audienceApplauseMeter/bakedTextMeter.js @@ -21,14 +21,12 @@ var avatarLoudnessPool = []; function average(a) { - var sum = 0; var total = a.length; for (var i = 0; i < total; i++) { sum += a[i]; } - - return Math.round(sum / total) + return Math.round(sum / total); } function audioClamp(input) { @@ -41,7 +39,6 @@ avatars.forEach(function (id) { var avatar = AvatarList.getAvatar(id); avatarLoudnessPool.push(audioClamp(Math.round(avatar.audioLoudness))); - }); @@ -52,7 +49,7 @@ function normalizedAverage(a) { a = a.map(function (v) { - return Math.round(( 100 / MAX_AUDIO_THRESHOLD ) * v) + return Math.round(( 100 / MAX_AUDIO_THRESHOLD ) * v); }); return average(a); } @@ -62,13 +59,13 @@ var barProperties = Entities.getEntityProperties(barID); - var colorShift = 2.55 * norm; //shifiting the scale to 0 - 255 + var colorShift = 2.55 * norm; //shifting the scale to 0 - 255 var xShift = norm / 52; // changing scale from 0-100 to 0-1.9 ish - var normShift = xShift - 0.88; //shifitg local displacement (-0.90) + var normShift = xShift - 0.88; //shifting local displacement (-0.88) var halfShift = xShift / 2; Entities.editEntity(barID, { dimensions: {x: xShift, y: barProperties.dimensions.y, z: barProperties.dimensions.z}, - localPosition: {x: normShift - ( halfShift ), y: -0.0625, z: -0.015}, + localPosition: {x: normShift - (halfShift), y: -0.0625, z: -0.015}, color: {red: colorShift, green: barProperties.color.green, blue: barProperties.color.blue} }); diff --git a/unpublishedScripts/marketplace/audienceApplauseMeter/meter.js b/unpublishedScripts/marketplace/audienceApplauseMeter/meter.js index 24aed492c0..324589068d 100644 --- a/unpublishedScripts/marketplace/audienceApplauseMeter/meter.js +++ b/unpublishedScripts/marketplace/audienceApplauseMeter/meter.js @@ -13,7 +13,6 @@ var childZeroUserData = JSON.parse(Entities.getEntityProperties(children[0]).userData); if (childZeroUserData.name === "bar") { - barID = childZero.id; textID = childOne.id; } else { @@ -32,13 +31,11 @@ var avatarLoudnessPool = []; function average(a) { - var sum = 0; var total = a.length; for (var i = 0; i < total; i++) { sum += a[i]; } - return Math.round(sum / total) } @@ -63,21 +60,21 @@ function normalizedAverage(a) { a = a.map(function (v) { - return Math.round(( 100 / MAX_AUDIO_THRESHOLD ) * v) + return Math.round(( 100 / MAX_AUDIO_THRESHOLD ) * v); }); return average(a); } - var norm = normalizedAverage(framePool) ; + var norm = normalizedAverage(framePool); Entities.editEntity(textID, {text: "Loudness: % " + norm}); var barProperties = Entities.getEntityProperties(barID); - JSON.stringify(barProperties) ; - var colorShift = 2.55 * norm; //shifiting the scale to 0 - 255 + + var colorShift = 2.55 * norm; //shifting the scale to 0 - 255 var xShift = norm / 100; // changing scale from 0-100 to 0-1 - var normShift = xShift - .5; //shifitg scale form 0-1 to -.5 to .5 + var normShift = xShift - .5; //shifting scale form 0-1 to -.5 to .5 var halfShift = xShift / 2 ; Entities.editEntity(barID, { dimensions: {x: xShift, y: barProperties.dimensions.y, z: barProperties.dimensions.z}, diff --git a/unpublishedScripts/marketplace/audienceApplauseMeter/textEntityMeter.js b/unpublishedScripts/marketplace/audienceApplauseMeter/textEntityMeter.js index c3d120b727..f85e2241ca 100644 --- a/unpublishedScripts/marketplace/audienceApplauseMeter/textEntityMeter.js +++ b/unpublishedScripts/marketplace/audienceApplauseMeter/textEntityMeter.js @@ -13,7 +13,6 @@ var childZeroUserData = JSON.parse(Entities.getEntityProperties(children[0]).userData); if (childZeroUserData.name === "bar") { - barID = childZero.id; textID = childOne.id; originalText = childOne.text @@ -34,14 +33,12 @@ var avatarLoudnessPool = []; function average(a) { - var sum = 0; var total = a.length; for (var i = 0; i < total; i++) { sum += a[i]; } - - return Math.round(sum / total) + return Math.round(sum / total); } function audioClamp(input) { @@ -54,7 +51,6 @@ avatars.forEach(function (id) { var avatar = AvatarList.getAvatar(id); avatarLoudnessPool.push(audioClamp(Math.round(avatar.audioLoudness))); - }); @@ -65,7 +61,7 @@ function normalizedAverage(a) { a = a.map(function (v) { - return Math.round(( 100 / MAX_AUDIO_THRESHOLD ) * v) + return Math.round(( 100 / MAX_AUDIO_THRESHOLD ) * v); }); return average(a); } @@ -75,9 +71,9 @@ var barProperties = Entities.getEntityProperties(barID); - var colorShift = 2.55 * norm; //shifiting the scale to 0 - 255 + var colorShift = 2.55 * norm; //shifting the scale to 0 - 255 var xShift = norm / 52; // changing scale from 0-100 to 0-1.9 ish - var normShift = xShift - 0.88; //shifitg local displacement (-0.88) + var normShift = xShift - 0.88; //shifting local displacement (-0.88) var halfShift = xShift / 2; Entities.editEntity(barID, { dimensions: {x: xShift, y: barProperties.dimensions.y, z: barProperties.dimensions.z},