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.23 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,iBAAkB,CAAA,QAAA,EAAoB,CAAW,EAAA,MAAA,EAAiB,QAAiB,IACnG,EAAA;AACI,EAAA,MAAM,IAAI,CAAE,CAAA,CAAA,CAAA;AACZ,EAAA,MAAM,IAAI,CAAE,CAAA,CAAA,CAAA;AACZ,EAAA,MAAM,IAAI,CAAE,CAAA,CAAA,CAAA;AACZ,EAAA,MAAM,IAAI,CAAE,CAAA,CAAA,CAAA;AACZ,EAAA,MAAM,KAAK,CAAE,CAAA,EAAA,CAAA;AACb,EAAA,MAAM,KAAK,CAAE,CAAA,EAAA,CAAA;AAEb,EAAW,MAAA,KAAA,MAAA,GAAA,CAAA,CAAA,CAAA;AACX,EAAW,MAAA,KAAA,MAAA,GAAA,CAAA,CAAA,CAAA;AACX,EAAU,IAAA,KAAA,IAAA,GAAA,QAAA,CAAS,SAAS,MAAU,GAAA,MAAA,CAAA,CAAA;AAEtC,EAAA,IAAI,QAAQ,MAAS,GAAA,MAAA,CAAA;AAErB,EAAA,KAAA,IAAS,CAAI,GAAA,CAAA,EAAG,CAAI,GAAA,IAAA,EAAM,CAC1B,EAAA,EAAA;AACI,IAAM,MAAA,CAAA,GAAI,SAAS,KAAK,CAAA,CAAA;AACxB,IAAM,MAAA,CAAA,GAAI,QAAS,CAAA,KAAA,GAAQ,CAAC,CAAA,CAAA;AAE5B,IAAA,QAAA,CAAS,KAAK,CAAA,GAAK,CAAI,GAAA,CAAA,GAAM,IAAI,CAAK,GAAA,EAAA,CAAA;AACtC,IAAA,QAAA,CAAS,QAAQ,CAAC,CAAA,GAAK,CAAI,GAAA,CAAA,GAAM,IAAI,CAAK,GAAA,EAAA,CAAA;AAE1C,IAAS,KAAA,IAAA,MAAA,CAAA;AAAA,GACb;AACJ;;;;"}