aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Bornand <nicolas74@gmail.com>2014-05-10 18:44:25 +0200
committerNicolas Bornand <nicolas74@gmail.com>2014-05-10 18:44:25 +0200
commitd3d8d0c03d710bddf4a5d7b971597fdce52c43c7 (patch)
tree5fff0920d2c51ab745c75e49e6f811bc9651ef0f
parent8b6ff428f2f482f94c533e2b4366cd7316f3244a (diff)
downloadplayGraph-d3d8d0c03d710bddf4a5d7b971597fdce52c43c7.tar.gz
playGraph-d3d8d0c03d710bddf4a5d7b971597fdce52c43c7.tar.bz2
playGraph-d3d8d0c03d710bddf4a5d7b971597fdce52c43c7.zip
add path service
-rw-r--r--app/js/services.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/app/js/services.js b/app/js/services.js
index 1788915..cb6699b 100644
--- a/app/js/services.js
+++ b/app/js/services.js
@@ -33,7 +33,8 @@ app.service('pathService', function() {
//randomly select one song
var index = Math.floor(Math.random()*songList.length);
var song = songList[index];
- var ratio = song.minDist/maxDistOverall;
+ var tuneParameter = 2;
+ var ratio = song.minDist/(maxDistOverall*tuneParameter);
console.log(ratio);
//favor the ones closer to the path
var weight = 1 - ratio*ratio;
@@ -41,7 +42,7 @@ app.service('pathService', function() {
songList.splice(index, 1);
selection.push(song);
}
- duration = 0;
+ duration += 20;
}
selection.sort(function(item){ return item.closestIndex;});
console.log(selection);