# SvgsModule

The `SvgsModule` module enables working with SVGs.

## Example

```
//==============================================================================
// The following example demonstrates how to bind an SVG image to a vector
// object.
//
// Project setup:
// - Insert a vector object
//==============================================================================

// Load in the required modules
const Scene = require('Scene');
const Svgs = require('Svgs');

// Locate the SVG file in the Assets
const mySvg = Svgs.get('mySvg');

// Locate the vector object in the Scene
const vectorObject = Scene.root.find('vectorObject0');

// Bind the Svg to the vector object
vectorObject.svg = mySvg;
```

## Properties

This module exposes no properties.

## Methods

| Method             | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `findFirst`        | <p><code>findFirst(name: string): Promise\<Svg></code></p><p>Returns a promise that is resolved with the svg of a requested name or null if none was found. <strong>See Also</strong>: <code>Svgs.findUsingPattern</code>, <code>Svgs.getAll</code>.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `findUsingPattern` | <p><code>findUsingPattern(namePattern: string): Promise\<Array\<Svg>> findUsingPattern(namePattern: string, config: {limit: number}): Promise\<Array\<Svg>></code></p><p>Returns a promise that is resolved with the all of the svgs matching the name pattern or empty array if none was found.</p><p>Pattern format: <code>*</code> matches any characters sequence. <code>\</code> can be used to include in pattern any of the control characters (including '' itself)</p><p>Examples: <code>findUsingPattern("*")</code> will retrive all of the svgs. <code>findUsingPattern("*A")</code> will retrieve all of the svgs suffixed with 'A'. <code>findUsingPattern("A*")</code> will retrieve all of the svgs prefixed with 'A'. <code>findUsingPattern("*A*", {limit: 10})</code> will retrieve at most 10 of the svgs containing 'A',</p><p><code>limit</code> parameter describes if <code>findUsingPattern</code> should finish the search if it finds specified number of results (default is no limit). Non-positive values for limit are treated as unlimited.</p><p><strong>See Also</strong>: <code>Svgs.getAll</code>, <code>Svgs.findFirst</code>.</p> |
| `get`              | <p><code>get(svgName: string): Svg</code></p><p>Returns a svg object identified by the <code>svgName</code> argument.</p><p>Throws an exception if there is no such identifier in the project.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `getAll`           | <p><code>getAll(): Promise\<Array\<Svg>></code></p><p>Returns a promise that is resolved with all of the svgs. <strong>See Also</strong>: <code>Svgs.findUsingPattern</code>, <code>Svgs.findFirst</code>.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |

## Classes

| Class                                                                                 | Description                                    |
| ------------------------------------------------------------------------------------- | ---------------------------------------------- |
| [`Svg`](https://sparkar.facebook.com/docs/ar-studio/reference/classes/svgsmodule.svg) | The `Svg` class describes an SVG in an effect. |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://sparkar-community.gitbook.io/docs/svgsmodule.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
