UNPKG

pixi.js

Version:

<p align="center"> <a href="https://pixijs.com" target="_blank" rel="noopener noreferrer"> <img height="150" src="https://files.pixijs.download/branding/pixijs-logo-transparent-dark.svg?v=1" alt="PixiJS logo"> </a> </p> <br/> <p align="center">

1 lines 2.16 kB
{"version":3,"file":"transformVertices.mjs","sources":["../../../../../../src/rendering/renderers/shared/geometry/utils/transformVertices.ts"],"sourcesContent":["import type { Matrix } from '../../../../../maths/matrix/Matrix';\n\n/**\n * Transforms the vertices in an array with the given matrix.\n * @param vertices - the vertices to transform\n * @param m - the matrix to apply to the vertices\n * @param offset - the offset of the vertices (defaults to 0)\n * @param stride - the stride of the vertices (defaults to 2)\n * @param size - the size of the vertices (defaults to vertices.length / stride - offset)\n * @category rendering\n * @internal\n */\nexport function transformVertices(vertices: number[], m: Matrix, offset?: number, stride?: number, size?: number)\n{\n const a = m.a;\n const b = m.b;\n const c = m.c;\n const d = m.d;\n const tx = m.tx;\n const ty = m.ty;\n\n offset ||= 0;\n stride ||= 2;\n size ||= (vertices.length / stride) - offset;\n\n let index = offset * stride;\n\n for (let i = 0; i < size; i++)\n {\n const x = vertices[index];\n const y = vertices[index + 1];\n\n vertices[index] = (a * x) + (c * y) + tx;\n vertices[index + 1] = (b * x) + (d * y) + ty;\n\n index += stride;\n }\n}\n"],"names":[],"mappings":";AAYO,SAAS,iBAAA,CAAkB,QAAA,EAAoB,CAAA,EAAW,MAAA,EAAiB,QAAiB,IAAA,EACnG;AACI,EAAA,MAAM,IAAI,CAAA,CAAE,CAAA;AACZ,EAAA,MAAM,IAAI,CAAA,CAAE,CAAA;AACZ,EAAA,MAAM,IAAI,CAAA,CAAE,CAAA;AACZ,EAAA,MAAM,IAAI,CAAA,CAAE,CAAA;AACZ,EAAA,MAAM,KAAK,CAAA,CAAE,EAAA;AACb,EAAA,MAAM,KAAK,CAAA,CAAE,EAAA;AAEb,EAAA,MAAA,KAAA,MAAA,GAAW,CAAA,CAAA;AACX,EAAA,MAAA,KAAA,MAAA,GAAW,CAAA,CAAA;AACX,EAAA,IAAA,KAAA,IAAA,GAAU,QAAA,CAAS,SAAS,MAAA,GAAU,MAAA,CAAA;AAEtC,EAAA,IAAI,QAAQ,MAAA,GAAS,MAAA;AAErB,EAAA,KAAA,IAAS,CAAA,GAAI,CAAA,EAAG,CAAA,GAAI,IAAA,EAAM,CAAA,EAAA,EAC1B;AACI,IAAA,MAAM,CAAA,GAAI,SAAS,KAAK,CAAA;AACxB,IAAA,MAAM,CAAA,GAAI,QAAA,CAAS,KAAA,GAAQ,CAAC,CAAA;AAE5B,IAAA,QAAA,CAAS,KAAK,CAAA,GAAK,CAAA,GAAI,CAAA,GAAM,IAAI,CAAA,GAAK,EAAA;AACtC,IAAA,QAAA,CAAS,QAAQ,CAAC,CAAA,GAAK,CAAA,GAAI,CAAA,GAAM,IAAI,CAAA,GAAK,EAAA;AAE1C,IAAA,KAAA,IAAS,MAAA;AAAA,EACb;AACJ;;;;"}