| OLD | NEW |
| 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * @constructor | 6 * @constructor |
| 7 * @param {number} width | 7 * @param {number} width |
| 8 * @param {number} height | 8 * @param {number} height |
| 9 * @param {number} marginTop | 9 * @param {number} marginTop |
| 10 * @param {number} controlPointRadius | 10 * @param {number} controlPointRadius |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 var current = bezier.evaluateAt(t); | 118 var current = bezier.evaluateAt(t); |
| 119 var slope = (current.y - prev.y) / (current.x - prev.x); | 119 var slope = (current.y - prev.y) / (current.x - prev.x); |
| 120 var weightedX = prev.x * (1 - t) + current.x * t; | 120 var weightedX = prev.x * (1 - t) + current.x * t; |
| 121 slope = Math.tanh(slope / 1.5); // Normalise slope | 121 slope = Math.tanh(slope / 1.5); // Normalise slope |
| 122 pathBuilder = pathBuilder.concat(["L", (weightedX * width).toFixed(2), (
height - slope * height).toFixed(2) ]); | 122 pathBuilder = pathBuilder.concat(["L", (weightedX * width).toFixed(2), (
height - slope * height).toFixed(2) ]); |
| 123 prev = current; | 123 prev = current; |
| 124 } | 124 } |
| 125 pathBuilder = pathBuilder.concat(["L", width.toFixed(2), height, "Z"]); | 125 pathBuilder = pathBuilder.concat(["L", width.toFixed(2), height, "Z"]); |
| 126 path.setAttribute("d", pathBuilder.join(" ")); | 126 path.setAttribute("d", pathBuilder.join(" ")); |
| 127 } | 127 } |
| OLD | NEW |