(curve)
| 263 | * @return {?CurveDef} |
| 264 | */ |
| 265 | export function getCurve(curve) { |
| 266 | if (!curve) { |
| 267 | return null; |
| 268 | } |
| 269 | if (isString(curve)) { |
| 270 | curve = /** @type {string} */ (curve); |
| 271 | // If the curve is a custom cubic-bezier curve |
| 272 | if (curve.indexOf('cubic-bezier') != -1) { |
| 273 | const match = curve.match(/cubic-bezier\((.+)\)/); |
| 274 | if (match) { |
| 275 | const values = match[1].split(',').map(parseFloat); |
| 276 | if (values.length == 4) { |
| 277 | for (let i = 0; i < 4; i++) { |
| 278 | if (isNaN(values[i])) { |
| 279 | return null; |
| 280 | } |
| 281 | } |
| 282 | return bezierCurve(values[0], values[1], values[2], values[3]); |
| 283 | } |
| 284 | } |
| 285 | return null; |
| 286 | } |
| 287 | return NAME_MAP[curve]; |
| 288 | } |
| 289 | return /** @type {CurveDef} */ (curve); |
| 290 | } |
no test coverage detected