{"version":3,"file":"drawStar.mjs","sources":["../src/drawStar.ts"],"sourcesContent":["import { PI_2, Polygon } from 'pixijs/core';\n\nimport type { Graphics } from 'pixijs/graphics';\n\n/**\n * Draw a star shape with an arbitrary number of points.\n * @ignore\n */\nclass Star extends Polygon\n{\n    /**\n     * @param x - Center X position of the star\n     * @param y - Center Y position of the star\n     * @param points - The number of points of the star, must be > 1\n     * @param radius - The outer radius of the star\n     * @param innerRadius - The inner radius between points, default half `radius`\n     * @param rotation - The rotation of the star in radians, where 0 is vertical\n     */\n    constructor(x: number, y: number, points: number, radius: number, innerRadius?: number, rotation = 0)\n    {\n        innerRadius = innerRadius || radius / 2;\n\n        const startAngle = (-1 * Math.PI / 2) + rotation;\n        const len = points * 2;\n        const delta = PI_2 / len;\n        const polygon = [];\n\n        for (let i = 0; i < len; i++)\n        {\n            const r = i % 2 ? innerRadius : radius;\n            const angle = (i * delta) + startAngle;\n\n            polygon.push(\n                x + (r * Math.cos(angle)),\n                y + (r * Math.sin(angle))\n            );\n        }\n\n        super(polygon);\n    }\n}\n\n/**\n * Draw a star shape with an arbitrary number of points.\n *\n * _Note: Only available with **pixijs/graphics/extras**._\n * @method PIXI.Graphics#drawStar\n * @param this\n * @param x - Center X position of the star\n * @param y - Center Y position of the star\n * @param points - The number of points of the star, must be > 1\n * @param radius - The outer radius of the star\n * @param innerRadius - The inner radius between points, default half `radius`\n * @param rotation - The rotation of the star in radians, where 0 is vertical\n * @returns - This Graphics object. Good for chaining method calls\n */\nexport function drawStar(this: Graphics,\n    x: number,\n    y: number,\n    points: number,\n    radius: number,\n    innerRadius: number,\n    rotation = 0): Graphics\n{\n    return this.drawPolygon(new Star(x, y, points, radius, innerRadius, rotation) as Polygon);\n}\n"],"names":[],"mappings":";;AAQA,MAAM,aAAa,OACnB,CAAA;AAAA,EASI,YAAY,CAAW,EAAA,CAAA,EAAW,QAAgB,MAAgB,EAAA,WAAA,EAAsB,WAAW,CACnG,EAAA;AACI,IAAA,WAAA,GAAc,eAAe,MAAS,GAAA,CAAA,CAAA;AAEtC,IAAA,MAAM,UAAc,GAAA,CAAA,CAAA,GAAK,IAAK,CAAA,EAAA,GAAK,CAAK,GAAA,QAAA,CAAA;AACxC,IAAA,MAAM,MAAM,MAAS,GAAA,CAAA,CAAA;AACrB,IAAA,MAAM,QAAQ,IAAO,GAAA,GAAA,CAAA;AACrB,IAAA,MAAM,UAAU,EAAC,CAAA;AAEjB,IAAA,KAAA,IAAS,CAAI,GAAA,CAAA,EAAG,CAAI,GAAA,GAAA,EAAK,CACzB,EAAA,EAAA;AACI,MAAM,MAAA,CAAA,GAAI,CAAI,GAAA,CAAA,GAAI,WAAc,GAAA,MAAA,CAAA;AAChC,MAAM,MAAA,KAAA,GAAS,IAAI,KAAS,GAAA,UAAA,CAAA;AAE5B,MAAA,OAAA,CAAQ,IACJ,CAAA,CAAA,GAAK,CAAI,GAAA,IAAA,CAAK,GAAI,CAAA,KAAK,CACvB,EAAA,CAAA,GAAK,CAAI,GAAA,IAAA,CAAK,GAAI,CAAA,KAAK,CAC3B,CAAA,CAAA;AAAA,KACJ;AAEA,IAAA,KAAA,CAAM,OAAO,CAAA,CAAA;AAAA,GACjB;AACJ,CAAA;AAgBO,SAAA,QAAA,CACH,GACA,CACA,EAAA,MAAA,EACA,MACA,EAAA,WAAA,EACA,WAAW,CACf,EAAA;AACI,EAAO,OAAA,IAAA,CAAK,WAAY,CAAA,IAAI,IAAK,CAAA,CAAA,EAAG,GAAG,MAAQ,EAAA,MAAA,EAAQ,WAAa,EAAA,QAAQ,CAAY,CAAA,CAAA;AAC5F;;;;"}