(rawPath)
| 1466 | */ |
| 1467 | |
| 1468 | export function rawPathToString(rawPath) { |
| 1469 | if (_isNumber(rawPath[0])) { |
| 1470 | //in case a segment is passed in instead |
| 1471 | rawPath = [rawPath]; |
| 1472 | } |
| 1473 | |
| 1474 | var result = "", |
| 1475 | l = rawPath.length, |
| 1476 | sl, |
| 1477 | s, |
| 1478 | i, |
| 1479 | segment; |
| 1480 | |
| 1481 | for (s = 0; s < l; s++) { |
| 1482 | segment = rawPath[s]; |
| 1483 | result += "M" + _round(segment[0]) + "," + _round(segment[1]) + " C"; |
| 1484 | sl = segment.length; |
| 1485 | |
| 1486 | for (i = 2; i < sl; i++) { |
| 1487 | result += _round(segment[i++]) + "," + _round(segment[i++]) + " " + _round(segment[i++]) + "," + _round(segment[i++]) + " " + _round(segment[i++]) + "," + _round(segment[i]) + " "; |
| 1488 | } |
| 1489 | |
| 1490 | if (segment.closed) { |
| 1491 | result += "z"; |
| 1492 | } |
| 1493 | } |
| 1494 | |
| 1495 | return result; |
| 1496 | } |
| 1497 | /* |
| 1498 | // takes a segment with coordinates [x, y, x, y, ...] and converts the control points into angles and lengths [x, y, angle, length, angle, length, x, y, angle, length, ...] so that it animates more cleanly and avoids odd breaks/kinks. For example, if you animate from 1 o'clock to 6 o'clock, it'd just go directly/linearly rather than around. So the length would be very short in the middle of the tween. |
| 1499 | export function cpCoordsToAngles(segment, copy) { |
no test coverage detected
searching dependent graphs…