mwg API
    Preparing search index...

    Function loadSvgParts

    • Slice named SVG groups into cached textures, without game-owned renderer calls. Accepts inert SVG source or an asset path (compiled data URIs work under file://). Shared definitions, styles, group attributes and the full viewBox are retained. The cache belongs to Pixi Assets: consumers borrow textures and release them with releaseSvgParts once no sprite uses them. Different resolutions have separate entries.

      Parameters

      Returns Promise<Readonly<Record<string, Texture<TextureSource<any>>>>>

      import { loadSvgParts, releaseSvgParts } from '@datamoc/mwg/assets';
      const parts = await loadSvgParts('<svg xmlns="http://www.w3.org/2000/svg" width="20" height="10"><g id="body"><rect width="20" height="10"/></g></svg>', { resolution: 2 });
      console.log(parts.body.width);
      await releaseSvgParts(parts);