diff options
author | Pushkar Joshi | 2012-06-12 10:21:03 -0700 |
---|---|---|
committer | Pushkar Joshi | 2012-06-12 10:21:03 -0700 |
commit | c7135de92b25b380bebcafac541821a3696cfdfa (patch) | |
tree | 406f1f3f51a0fe576469a5e9b5d3a8d149feceb9 | |
parent | 4d9b676db06a3d4ff5f4cf0f35e8fc998e0000c5 (diff) | |
download | ninja-c7135de92b25b380bebcafac541821a3696cfdfa.tar.gz |
change the brush runtime to ignore hardness in case of strokewidth of 1
-rw-r--r-- | assets/canvas-runtime.js | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/assets/canvas-runtime.js b/assets/canvas-runtime.js index c2ab0bd8..feb35187 100644 --- a/assets/canvas-runtime.js +++ b/assets/canvas-runtime.js | |||
@@ -2264,7 +2264,10 @@ NinjaCvsRt.RuntimeBrushStroke = Object.create(NinjaCvsRt.RuntimeGeomObj, { | |||
2264 | var disp = [brushStamp[t][0], brushStamp[t][1]]; | 2264 | var disp = [brushStamp[t][0], brushStamp[t][1]]; |
2265 | var alphaVal = 1.0; | 2265 | var alphaVal = 1.0; |
2266 | var distFromOpaqueRegion = Math.abs(t-halfNumTraces) - opaqueRegionHalfWidth; | 2266 | var distFromOpaqueRegion = Math.abs(t-halfNumTraces) - opaqueRegionHalfWidth; |
2267 | if (distFromOpaqueRegion>0) { | 2267 | if (numTraces === 1){ |
2268 | distFromOpaqueRegion = 0; | ||
2269 | } | ||
2270 | else if (distFromOpaqueRegion>0) { | ||
2268 | var transparencyFactor = distFromOpaqueRegion/maxTransparentRegionHalfWidth; | 2271 | var transparencyFactor = distFromOpaqueRegion/maxTransparentRegionHalfWidth; |
2269 | alphaVal = 1.0 - transparencyFactor;//(transparencyFactor*transparencyFactor);//the square term produces nonlinearly varying alpha values | 2272 | alphaVal = 1.0 - transparencyFactor;//(transparencyFactor*transparencyFactor);//the square term produces nonlinearly varying alpha values |
2270 | alphaVal *= 0.5; //factor that accounts for lineWidth == 2 | 2273 | alphaVal *= 0.5; //factor that accounts for lineWidth == 2 |