Skip to content

Commit

Permalink
constant radius color scheme with stroke
Browse files Browse the repository at this point in the history
  • Loading branch information
aadish committed Mar 4, 2016
1 parent 53eebd7 commit de2200b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
8 changes: 4 additions & 4 deletions js/gravity-force-lab/model/Mass.js
Original file line number Diff line number Diff line change
Expand Up @@ -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

/**
*
Expand All @@ -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 );
}
});

Expand All @@ -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 );
}
});

Expand Down
2 changes: 1 addition & 1 deletion js/gravity-force-lab/view/ControlPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
7 changes: 7 additions & 0 deletions js/gravity-force-lab/view/MassObject.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down

0 comments on commit de2200b

Please sign in to comment.