(value: string)
| 23 | } |
| 24 | |
| 25 | function parseCubicBezierCurve(value: string) { |
| 26 | const coordsString = /\((.*?)\)/.exec(value); |
| 27 | const coords = coordsString && coordsString[1].split(',').map(stringToBezieCoords); |
| 28 | |
| 29 | if (value.startsWith('cubic-bezier') && coordsString && coords.length === 4) { |
| 30 | const [x1, x2, y1, y2] = [...coords]; |
| 31 | |
| 32 | return CoreTypes.AnimationCurve.cubicBezier(x1, x2, y1, y2); |
| 33 | } else { |
| 34 | throw new Error(`Invalid value for animation: ${value}`); |
| 35 | } |
| 36 | } |
| 37 | |
| 38 | function stringToBezieCoords(value: string): number { |
| 39 | const result = parseFloat(value); |
no test coverage detected