From 1eaf5ae82a5202707c2f71bf32a5253214a35806 Mon Sep 17 00:00:00 2001 From: ericrius1 Date: Fri, 19 Jun 2015 10:37:57 -0700 Subject: [PATCH] fixed utilities file to be able to be referenced by other files --- examples/utilities.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/examples/utilities.js b/examples/utilities.js index 3844e23e14..3c2423c914 100644 --- a/examples/utilities.js +++ b/examples/utilities.js @@ -9,7 +9,13 @@ // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -function hslToRgb(hslColor) { +////***************** UTILITIES ************************************* + +map = function(value, min1, max1, min2, max2) { + return min2 + (max2 - min2) * ((value - min1) / (max1 - min1)); +} + +hslToRgb = function (hslColor) { var h = hslColor.hue; var s = hslColor.sat; var l = hslColor.light; @@ -42,15 +48,13 @@ function hslToRgb(hslColor) { } -function map(value, min1, max1, min2, max2) { - return min2 + (max2 - min2) * ((value - min1) / (max1 - min1)); -} -function randFloat(low, high) { + +randFloat = function(low, high) { return low + Math.random() * (high - low); } -function randInt(low, high) { +randInt = function(low, high) { return Math.floor(randFloat(low, high)); } \ No newline at end of file