UNPKG

motion-dom

Version:
1 lines • 2.03 kB
{"version":3,"file":"transform.mjs","sources":["../../../../src/effects/style/transform.ts"],"sourcesContent":["import {\n isDefaultTransform,\n transformFunction,\n} from \"../../render/html/utils/build-transform\"\nimport { MotionValueState } from \"../MotionValueState\"\n\nexport function buildTransform(state: MotionValueState) {\n let transform = \"\"\n const { transformKeys: keys = [], transformValues: values = {} } = state\n\n /**\n * Loop over the bound transforms in order, adding the ones that\n * aren't at their default value to the transform string.\n */\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i]\n const value = values[key].getCurrent()\n\n if (value === undefined) continue\n\n if (!isDefaultTransform(key, value)) {\n transform += (transform && \" \") + transformFunction(key, value)\n }\n }\n\n // See build-transform.ts: additive `rotate()` so user `rotate` isn't\n // clobbered. Not a `transformPropOrder` slot.\n const pathRotation = state.get(\"pathRotation\")?.get()\n if (pathRotation) {\n transform +=\n (transform && \" \") + transformFunction(\"rotate\", pathRotation)\n }\n\n return transform || \"none\"\n}\n"],"names":[],"mappings":";;AAMM,SAAU,cAAc,CAAC,KAAuB,EAAA;IAClD,IAAI,SAAS,GAAG,EAAE;AAClB,IAAA,MAAM,EAAE,aAAa,EAAE,IAAI,GAAG,EAAE,EAAE,eAAe,EAAE,MAAM,GAAG,EAAE,EAAE,GAAG,KAAK;AAExE;;;AAGG;AACH,IAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;AAClC,QAAA,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC;QACnB,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE;QAEtC,IAAI,KAAK,KAAK,SAAS;YAAE;QAEzB,IAAI,CAAC,kBAAkB,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE;AACjC,YAAA,SAAS,IAAI,CAAC,SAAS,IAAI,GAAG,IAAI,iBAAiB,CAAC,GAAG,EAAE,KAAK,CAAC;QACnE;IACJ;;;IAIA,MAAM,YAAY,GAAG,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,EAAE,GAAG,EAAE;IACrD,IAAI,YAAY,EAAE;QACd,SAAS;YACL,CAAC,SAAS,IAAI,GAAG,IAAI,iBAAiB,CAAC,QAAQ,EAAE,YAAY,CAAC;IACtE;IAEA,OAAO,SAAS,IAAI,MAAM;AAC9B;;;;"}