From 191a4740a392905e148238aa60198749ea2b11fb Mon Sep 17 00:00:00 2001 From: ericrius1 Date: Thu, 1 Oct 2015 09:50:58 -0700 Subject: [PATCH] laser color matches paint color --- examples/acScripts/rain.js | 6 ++++-- examples/closePaint.js | 17 +++++++++++------ 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/examples/acScripts/rain.js b/examples/acScripts/rain.js index 3f38b8d36a..fc02b7163f 100644 --- a/examples/acScripts/rain.js +++ b/examples/acScripts/rain.js @@ -18,7 +18,7 @@ var RainSquall = function (properties) { dropFallSpeed = 1, // m/s dropLifetime = 60, // Seconds dropSpinMax = 0, // Maximum angular velocity per axis; deg/s - debug = false, // Display origin circle; don't use running on Stack Manager + debug = true, // Display origin circle; don't use running on Stack Manager // Other squallCircle, SQUALL_CIRCLE_COLOR = { red: 255, green: 0, blue: 0 }, @@ -151,8 +151,10 @@ var RainSquall = function (properties) { }; }; +var center = Vec3.sum(MyAvatar.position, Vec3.multiply(3, Quat.getFront(Camera.getOrientation()))); +center.y += 10; var rainSquall1 = new RainSquall({ - origin: { x: 1195, y: 1223, z: 1020 }, + origin:center, radius: 25, dropsPerMinute: 120, dropSize: { x: 0.1, y: 0.1, z: 0.1 }, diff --git a/examples/closePaint.js b/examples/closePaint.js index fba2aa0e80..c17402857b 100644 --- a/examples/closePaint.js +++ b/examples/closePaint.js @@ -34,7 +34,7 @@ var RIGHT_2_ACTION = 16; var LEFT_4_ACTION = 17; var LEFT_2_ACTION = 16; -var HUE_INCREMENT = 0.01; +var HUE_INCREMENT = 0.02; var center = Vec3.sum(MyAvatar.position, Vec3.multiply(2, Quat.getFront(Camera.getOrientation()))); @@ -61,16 +61,17 @@ function MyController(hand, triggerAction) { this.strokeColor = { h: 0.8, - s: 0.9, + s: 0.8, l: 0.4 }; + this.laserPointer = Overlays.addOverlay("circle3d", { size: { x: STROKE_WIDTH / 2, y: STROKE_WIDTH / 2 }, - color: hslToRgb(this.strokeColor), + color: hslToRgb(this.strokeColor ), solid: true, position: center }) @@ -78,7 +79,6 @@ function MyController(hand, triggerAction) { this.prevTriggerValue = 0; var _this = this; - this.update = function() { this.updateControllerState() this.search(); @@ -232,6 +232,9 @@ function MyController(hand, triggerAction) { if (this.strokeColor.h < 0) { this.strokeColor = 1; } + Overlays.editOverlay(this.laserPointer, { + color: hslToRgb(this.strokeColor) + }); } this.cycleColorUp = function() { @@ -239,6 +242,9 @@ function MyController(hand, triggerAction) { if (this.strokeColor.h > 1) { this.strokeColor.h = 0; } + Overlays.editOverlay(this.laserPointer, { + color: hslToRgb(this.strokeColor) + }); } } @@ -308,9 +314,8 @@ function orientationOf(vector) { * @param Number l The lightness * @return Array The RGB representation */ -function hslToRgb(hsl) { +function hslToRgb(hsl, hueOffset) { var r, g, b; - if (hsl.s == 0) { r = g = b = hsl.l; // achromatic } else {