start options, cleanup

This commit is contained in:
James B. Pollack 2015-12-20 16:40:41 -08:00
parent 485bb4ee3f
commit da57e29096
2 changed files with 7 additions and 7 deletions

View file

@ -9,7 +9,7 @@ To reset, I recommend stopping all scripts then re-loading lightLoader.js
When you run the lightLoader.js script, several scripts will be loaded: When you run the lightLoader.js script, several scripts will be loaded:
- handControllerGrab.js (will not impart velocity when you move the parent or a slider, will not move sliders with head movement,will constrain movement for a slider to a given axis start and end) - handControllerGrab.js (will not impart velocity when you move the parent or a slider, will not move sliders with head movement,will constrain movement for a slider to a given axis start and end)
- lightModifier.js (listens for message to create sliders for a given light) - lightModifier.js (listens for message to create sliders for a given light. will start with slider set to the light's initial properties)
- lightModifierTestScene.js (creates a light) - lightModifierTestScene.js (creates a light)
- slider.js (attached to each slider entity) - slider.js (attached to each slider entity)
- lightParent.js (attached to a 3d model of a light, to which a light is parented, so you can move it around. or keep the current parent if a light already has a parent) - lightParent.js (attached to a 3d model of a light, to which a light is parented, so you can move it around. or keep the current parent if a light already has a parent)

View file

@ -50,16 +50,16 @@
var distance = Vec3.distance(this.userData.axisStart, currentPosition); var distance = Vec3.distance(this.userData.axisStart, currentPosition);
if (this.userData.sliderType === 'color_red' || this.userData.sliderType === 'color_green' || this.userData.sliderType === 'color_blue') { if (this.userData.sliderType === 'color_red' || this.userData.sliderType === 'color_green' || this.userData.sliderType === 'color_blue') {
this.sliderValue = this.scaleValueBasedOnDistanceFromStart(distance, COLOR_MAX); this.sliderValue = this.scaleValueBasedOnDistanceFromStart(distance, 0, COLOR_MAX);
} }
if (this.userData.sliderType === 'intensity') { if (this.userData.sliderType === 'intensity') {
this.sliderValue = this.scaleValueBasedOnDistanceFromStart(distance, INTENSITY_MAX); this.sliderValue = this.scaleValueBasedOnDistanceFromStart(distance, 0, INTENSITY_MAX);
} }
if (this.userData.sliderType === 'cutoff') { if (this.userData.sliderType === 'cutoff') {
this.sliderValue = this.scaleValueBasedOnDistanceFromStart(distance, CUTOFF_MAX); this.sliderValue = this.scaleValueBasedOnDistanceFromStart(distance, 0, CUTOFF_MAX);
} }
if (this.userData.sliderType === 'exponent') { if (this.userData.sliderType === 'exponent') {
this.sliderValue = this.scaleValueBasedOnDistanceFromStart(distance, EXPONENT_MAX); this.sliderValue = this.scaleValueBasedOnDistanceFromStart(distance, 0, EXPONENT_MAX);
}; };
this.sendValueToSlider(); this.sendValueToSlider();
@ -80,10 +80,10 @@
this.sendValueToSlider(); this.sendValueToSlider();
}, },
scaleValueBasedOnDistanceFromStart: function(value, max2) { scaleValueBasedOnDistanceFromStart: function(value, min2, max2) {
var min1 = 0; var min1 = 0;
var max1 = AXIS_SCALE; var max1 = AXIS_SCALE;
var min2 = 0; var min2 = min2;
var max2 = max2; var max2 = max2;
return min2 + (max2 - min2) * ((value - min1) / (max1 - min1)); return min2 + (max2 - min2) * ((value - min1) / (max1 - min1));
}, },