Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | 33x 33x 33x 33x 33x 33x 7x 7x 7x 7x 7x | import { MotionComponentConfig } from "../../motion" import { SVGRenderState } from "./types" import { renderSVG } from "./utils/render" import { scrapeMotionValuesFromProps as scrapeSVGProps } from "./utils/scrape-motion-values" import { makeUseVisualState } from "../../motion/utils/use-visual-state" import { createSvgRenderState } from "./utils/create-render-state" import { buildSVGAttrs } from "./utils/build-attrs" export const svgMotionConfig: Partial< MotionComponentConfig<SVGElement, SVGRenderState> > = { useVisualState: makeUseVisualState({ scrapeMotionValuesFromProps: scrapeSVGProps, createRenderState: createSvgRenderState, onMount: (props, instance, { renderState, latestValues }) => { try { renderState.dimensions = typeof (instance as SVGGraphicsElement).getBBox === "function" ? (instance as SVGGraphicsElement).getBBox() : (instance.getBoundingClientRect() as DOMRect) } catch (e) { // Most likely trying to measure an unrendered element under Firefox renderState.dimensions = { x: 0, y: 0, width: 0, height: 0, } } buildSVGAttrs( renderState, latestValues, { enableHardwareAcceleration: false }, props.transformTemplate ) // TODO: Replace with direct assignment renderSVG(instance, renderState) }, }), } |