Debug count slider display.

master
Ben Burlingham 8 years ago
parent 844e890605
commit adef9df7e6
  1. 7
      js/arc.js
  2. 8
      js/bundle.js
  3. 12
      js/controls.js
  4. 3
      js/index.js
  5. 8
      js/particle.js

@ -7,7 +7,7 @@ const rigidity = 0.9;
const sensitivity = 30;
const Arc = {
create: function(bounds, grid) {
create: function(bounds) {
let arc = {
centerX: Random.num(0, bounds.width),
centerY: Random.num(0, bounds.height),
@ -30,11 +30,6 @@ const Arc = {
arc = Arc.overflow(arc, bounds);
// If starting in a hazard, recurse.
// if (grid.getPoint({ x: arc.endX, y: arc.endY, type: ENTITIES.HAZARD })) {
// arc = Arc.create(bounds, grid);
// }
return arc;
},

File diff suppressed because one or more lines are too long

12
js/controls.js vendored

@ -16,7 +16,7 @@ export default function(destroy$, {
const observables = {
fps$: new Rx.Subject(),
count$: createCountControl(container, 0, maxCount),
count$: createCountControl(container, count, maxCount),
speed$: createSpeedControl(container),
circle$: showCircleControl && createCircleControl(container),
randomize$: showRandomizeControl && createRandomizeControl(container),
@ -27,10 +27,7 @@ export default function(destroy$, {
observables.animating$.subscribe((isAnimating) => {
if (isAnimating === true) {
destroy$.next(id);
if (observables.count$.getValue() === 0) {
observables.count$.next(count);
}
observables.count$.next(count);
}
});
@ -80,7 +77,7 @@ function createCountControl(container, initialValue, max) {
label.className = 'controls-range';
const text = document.createElement('span');
text.innerHTML = (initialValue == 1) ? '1 particle' : `${initialValue} particles`;
// text.innerHTML = (initialValue == 1) ? '1 particle' : `${initialValue} particles`;
text.className = 'controls-range-text';
const slider = document.createElement('input');
@ -102,7 +99,8 @@ function createCountControl(container, initialValue, max) {
});
count$.subscribe((value) => {
text.innerHTML = (value == 1) ? '1 particle' : `${value} particles`;
console.warn('count changed! ', value)
text.innerHTML = (value === 1) ? '1 particle' : `${value} particles`;
});
return count$;

@ -29,10 +29,7 @@ window.addEventListener('load', () => {
// TODO remove bottom padding from Disqus
// TODO sort out particle nextframe
// TODO abs positioning on controls elements so order doesn't matter
// TODO BehaviorSubject listener on bounds change
// TODO are vision grid nodes removed properly
// TODO grid touches
// TODO start with n particles doesn't update slider
// TODO leader not quite right, if 2 particles, sometimes ignored
// TODO Randomize leaders every 30 sec

@ -301,8 +301,6 @@ function updateVisionGrid(arc, config, grids) {
function repaintContainer(node, arc, leaderTime) {
node.style.left = `${arc.endX}px`;
node.style.top = `${arc.endY}px`;
(leaderTime > 0) ? node.style.zIndex = '2000' : node.style.zIndex = '2';
}
function repaintBody(node, arc, leaderTime) {
@ -311,8 +309,6 @@ function repaintBody(node, arc, leaderTime) {
: RAD.t360 - arc.theta;
node.style.transform = `rotate(${rad + RAD.t45}rad)`;
(leaderTime > 0) ? node.style.border = '3px dotted #fff' : node.style.border = '';
}
function repaintCircle(node, arc) {
@ -334,11 +330,11 @@ function repaintVisionGrid(nodes, arc, grids) {
return;
}
grids.vision.forEach(({ x, y, touch }, i) => {
grids.vision.forEach(({ x, y }, i) => {
nodes[i].style.left = `${x}px`;
nodes[i].style.top = `${y}px`;
nodes[i].style.border = (touch ? '2px solid red' : '0');
// nodes[i].style.border = (touch ? '2px solid red' : '0');
});
}

Loading…
Cancel
Save