From de2200b1ecc19c0e5b6aacb5629385b817dff2f0 Mon Sep 17 00:00:00 2001 From: Aadish Gupta Date: Fri, 4 Mar 2016 13:14:20 -0700 Subject: [PATCH] constant radius color scheme with stroke --- js/gravity-force-lab/model/Mass.js | 8 ++++---- js/gravity-force-lab/view/ControlPanel.js | 2 +- js/gravity-force-lab/view/MassObject.js | 7 +++++++ 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/js/gravity-force-lab/model/Mass.js b/js/gravity-force-lab/model/Mass.js index e3f69337..ffa3886f 100644 --- a/js/gravity-force-lab/model/Mass.js +++ b/js/gravity-force-lab/model/Mass.js @@ -16,8 +16,8 @@ define( function( require ) { //constants var DENSITY = 150; // kg/m^3 var CONSTANT_RADIUS = 0.5; // in meters - var CONSTANT_MASS_COLOR = new Color( 'thistle' ); - var COLOR_REDUCTION_CONSTANT = 2500; // empirically determined + var CONSTANT_MASS_COLOR = new Color( 'indigo' ); + var COLOR_REDUCTION_CONSTANT = 1000; // empirically determined /** * @@ -43,7 +43,7 @@ define( function( require ) { self.radius = self.calculateRadius( mass ); } else{ - self.baseColor = CONSTANT_MASS_COLOR.colorUtilsDarker( mass / COLOR_REDUCTION_CONSTANT ); + self.baseColor = CONSTANT_MASS_COLOR.colorUtilsBrighter( 1 - mass / COLOR_REDUCTION_CONSTANT ); } }); @@ -54,7 +54,7 @@ define( function( require ) { } else{ self.radius = CONSTANT_RADIUS; - self.baseColor = CONSTANT_MASS_COLOR.colorUtilsDarker( self.mass / COLOR_REDUCTION_CONSTANT ); + self.baseColor = CONSTANT_MASS_COLOR.colorUtilsBrighter( 1 - self.mass / COLOR_REDUCTION_CONSTANT ); } }); diff --git a/js/gravity-force-lab/view/ControlPanel.js b/js/gravity-force-lab/view/ControlPanel.js index 755bc572..4fc21a32 100644 --- a/js/gravity-force-lab/view/ControlPanel.js +++ b/js/gravity-force-lab/view/ControlPanel.js @@ -43,7 +43,7 @@ define( function( require ) { // init position element controlMass2.left = controlMass1.right + 50; controlShowValues.left = controlMass2.right + 50; - resetAllButton.centerX = controlShowValues.centerX; + resetAllButton.right = controlShowValues.right; resetAllButton.top = controlShowValues.bottom + 15; } diff --git a/js/gravity-force-lab/view/MassObject.js b/js/gravity-force-lab/view/MassObject.js index b927e652..f729509f 100644 --- a/js/gravity-force-lab/view/MassObject.js +++ b/js/gravity-force-lab/view/MassObject.js @@ -183,6 +183,13 @@ define( function( require ) { self.massCircle.fill = new RadialGradient( radius * 0.6, -radius * 0.6, 1, radius * 0.6, -radius * 0.6, radius ) .addColorStop( 0, baseColor.colorUtilsBrighter( 0.5 ).toCSS() ) .addColorStop( 1, baseColor.toCSS() ); + //debugger; + if ( model.constantRadius ) { + //self.massCircle.stroke = baseColor.colorUtilsBrighter( 0.5 ).toCSS(); + self.massCircle.stroke = baseColor.colorUtilsDarker( 0.15 ); + //self.massCircle.stroke = 'black'; + } + } ); redrawForce();