Max travel distance, fix bugs

This commit is contained in:
Tyler Hallada 2017-08-13 03:09:19 -04:00
parent c38f19dac0
commit 52b275cd0d
2 changed files with 25 additions and 8 deletions

View File

@ -117,13 +117,17 @@
<button type="button" id="reset">Reset Points</button>
</label><br />
<label><strong>Connection Distance:</strong>
<input type="range" name="connectDistRange" min="0" max="5000" value="0" oninput="this.form.connectDistInput.value=this.value" />
<input type="number" name="connectDistInput" min="0" max="5000" value="0" oninput="this.form.connectDistRange.value=this.value" />
<input type="range" name="connectDistRange" min="0" max="1000" value="0" oninput="this.form.connectDistInput.value=this.value" />
<input type="number" name="connectDistInput" min="0" max="1000" value="0" oninput="this.form.connectDistRange.value=this.value" />
</label><br />
<label><strong>Connection Limit:</strong>
<input type="range" name="connectLimitRange" min="0" max="100" value="10" oninput="this.form.connectLimitInput.value=this.value" />
<input type="number" name="connectLimitInput" min="0" max="100" value="10" oninput="this.form.connectLimitRange.value=this.value" />
</label><br />
<label><strong>Max Travel Distance:</strong>
<input type="range" name="maxTravelRange" min="0" max="1000" value="0" oninput="this.form.maxTravelInput.value=this.value" />
<input type="number" name="maxTravelInput" min="0" max="1000" value="0" oninput="this.form.maxTravelRange.value=this.value" />
</label><br />
<label><strong>Cycle Duration:</strong>
<input type="range" name="timeRange" min="1" max="360" value="60" oninput="this.form.timeInput.value=this.value" />
<input type="number" name="timeInput" min="1" max="360" value="60" oninput="this.form.timeRange.value=this.value" />

View File

@ -483,6 +483,7 @@ function getRandomPoints (numPoints, maxX, maxY, maxZ, tweeningFns) {
easingFn = tweeningFns[Math.floor(Math.random() * tweeningFns.length)];
// save PIXI Sprite for each point in array
sprite = createSprite();
if (!drawNodes) sprite.visible = false;
sprites.push(sprite);
stage.addChild(sprite);
points[i] = [x, y, z, cycleStart, color, easingFn];
@ -1035,6 +1036,18 @@ window.onload = function () {
numPoints = parseInt(this.value, 10);
});
var maxTravelRange = document.getElementsByName('maxTravelRange')[0];
maxTravelRange.value = pointShiftDistance;
maxTravelRange.addEventListener('input', function (e) {
pointShiftDistance = parseInt(this.value, 10);
});
var maxTravelInput = document.getElementsByName('maxTravelInput')[0];
maxTravelInput.value = pointShiftDistance;
maxTravelInput.addEventListener('input', function (e) {
pointShiftDistance = parseInt(this.value, 10);
});
var timeRange = document.getElementsByName('timeRange')[0];
timeRange.value = cycleDuration;
timeRange.addEventListener('input', function (e) {
@ -1077,9 +1090,9 @@ window.onload = function () {
lineSize = parseInt(this.value, 10);
});
var lineSizeRange = document.getElementsByName('lineSizeRange')[0];
lineSizeRange.value = lineSize;
lineSizeRange.addEventListener('input', function (e) {
var lineSizeInput = document.getElementsByName('lineSizeInput')[0];
lineSizeInput.value = lineSize;
lineSizeInput.addEventListener('input', function (e) {
lineSize = parseInt(this.value, 10);
});
@ -1089,9 +1102,9 @@ window.onload = function () {
disconnectedColorShiftAmt = parseInt(this.value, 10);
});
var colorShiftRange = document.getElementsByName('colorShiftRange')[0];
colorShiftRange.value = disconnectedColorShiftAmt;
colorShiftRange.addEventListener('input', function (e) {
var colorShiftInput = document.getElementsByName('colorShiftInput')[0];
colorShiftInput.value = disconnectedColorShiftAmt;
colorShiftInput.addEventListener('input', function (e) {
disconnectedColorShiftAmt = parseInt(this.value, 10);
});