* Convert the SVG element's style to a Motion Canvas Shape properties. * @param element - An SVG element whose style should be converted. * @param inheritedStyle - The parent style that should be inherited.
(
element: SVGGraphicsElement,
inheritedStyle: ShapeProps,
)
| 577 | * @param inheritedStyle - The parent style that should be inherited. |
| 578 | */ |
| 579 | private static getElementStyle( |
| 580 | element: SVGGraphicsElement, |
| 581 | inheritedStyle: ShapeProps, |
| 582 | ): ShapeProps { |
| 583 | return { |
| 584 | fill: element.getAttribute('fill') ?? inheritedStyle.fill, |
| 585 | stroke: element.getAttribute('stroke') ?? inheritedStyle.stroke, |
| 586 | lineWidth: element.hasAttribute('stroke-width') |
| 587 | ? parseFloat(element.getAttribute('stroke-width')!) |
| 588 | : inheritedStyle.lineWidth, |
| 589 | lineCap: |
| 590 | this.parseLineCap(element.getAttribute('stroke-linecap')) ?? |
| 591 | inheritedStyle.lineCap, |
| 592 | lineJoin: |
| 593 | this.parseLineJoin(element.getAttribute('stroke-linejoin')) ?? |
| 594 | inheritedStyle.lineJoin, |
| 595 | lineDash: |
| 596 | this.parseLineDash(element.getAttribute('stroke-dasharray')) ?? |
| 597 | inheritedStyle.lineDash, |
| 598 | lineDashOffset: |
| 599 | this.parseDashOffset(element.getAttribute('stroke-dashoffset')) ?? |
| 600 | inheritedStyle.lineDashOffset, |
| 601 | opacity: |
| 602 | this.parseOpacity(element.getAttribute('opacity')) ?? |
| 603 | inheritedStyle.opacity, |
| 604 | layout: false, |
| 605 | }; |
| 606 | } |
| 607 | |
| 608 | /** |
| 609 | * Extract `SVGShapeData` list from the SVG element's children. |
no test coverage detected