# Scene.import
Imports an animation, SVG, image or audio into the scene.

{/* Do not edit this file. It is automatically generated by API Documenter. */}

## Scene.import() method

This method has 4 overloads:

1. Imports a Lottie animation or an SVG into the scene
2. Imports an image from a URL into the scene
3. Imports audio into the scene
4. Imports an animation, SVG, image or audio into the scene

### Overload 1: Imports a Lottie animation or an SVG into the scene

**Signature:**

```typescript
import(opts: (ImportFromContent | ImportFromURL) & {
        type: 'LOTTIE' | 'SVG';
    }): Promise<SceneLayer>;
```

#### Parameters

<table>
  <thead>
    <tr>
      <th>
        Parameter
      </th>

      <th>
        Type
      </th>

      <th>
        Description
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        opts
      </td>

      <td>
        ([ImportFromContent](/en/creator-api/types/import-from-content) | [ImportFromURL](/en/creator-api/types/import-from-url)) & \{ type: 'LOTTIE' | 'SVG'; }
      </td>

      <td>
        Options for importing the animation or SVG
      </td>
    </tr>
  </tbody>
</table>

**Returns:**

Promise\<[SceneLayer](/en/creator-api/nodes/scene-layer)>

A promise that resolves to a scene layer holding the imported content

#### Remarks

The promise rejects if the import fails.

#### Example

```ts
const layer = await scene.import({ type: "LOTTIE", url: "https://example.com/animation.json" });
```

### Overload 2: Imports an image from a URL into the scene

**Signature:**

```typescript
import(opts: ImportFromURL & {
        type: 'IMAGE';
    }): Promise<ImageLayer>;
```

#### Parameters

<table>
  <thead>
    <tr>
      <th>
        Parameter
      </th>

      <th>
        Type
      </th>

      <th>
        Description
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        opts
      </td>

      <td>
        [ImportFromURL](/en/creator-api/types/import-from-url) & \{ type: 'IMAGE'; }
      </td>

      <td>
        Options for importing the image
      </td>
    </tr>
  </tbody>
</table>

**Returns:**

Promise\<[ImageLayer](/en/creator-api/nodes/image-layer)>

A promise that resolves to the new image layer

#### Remarks

The promise rejects if the import fails.

#### Example

```ts
const layer = await scene.import({ type: "IMAGE", url: "https://example.com/image.png" });
```

### Overload 3: Imports audio into the scene

**Signature:**

```typescript
import(opts: (ImportFromContent | ImportFromURL) & {
        type: 'AUDIO';
    }): Promise<AudioLayer>;
```

#### Parameters

<table>
  <thead>
    <tr>
      <th>
        Parameter
      </th>

      <th>
        Type
      </th>

      <th>
        Description
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        opts
      </td>

      <td>
        ([ImportFromContent](/en/creator-api/types/import-from-content) | [ImportFromURL](/en/creator-api/types/import-from-url)) & \{ type: 'AUDIO'; }
      </td>

      <td>
        Options for importing the audio, from base64 content or a URL
      </td>
    </tr>
  </tbody>
</table>

**Returns:**

Promise\<[AudioLayer](/en/creator-api/nodes/audio-layer)>

A promise that resolves to the new audio layer

#### Remarks

The layer starts at the scene's start frame and lasts as long as the audio.

The promise rejects if the import fails, for example because the format is not supported, the file is over 20 MB or the audio cannot be decoded. A failed import adds nothing to the scene.

#### Example

```ts
const layer = await scene.import({ type: "AUDIO", content: base64 });
```

### Overload 4: Imports an animation, SVG, image or audio into the scene

**Signature:**

```typescript
import(opts: ImportFromContent | ImportFromURL): Promise<SceneLayer | ImageLayer | AudioLayer>;
```

#### Parameters

<table>
  <thead>
    <tr>
      <th>
        Parameter
      </th>

      <th>
        Type
      </th>

      <th>
        Description
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        opts
      </td>

      <td>
        [ImportFromContent](/en/creator-api/types/import-from-content) | [ImportFromURL](/en/creator-api/types/import-from-url)
      </td>

      <td>
        Options for importing the content
      </td>
    </tr>
  </tbody>
</table>

**Returns:**

Promise\<[SceneLayer](/en/creator-api/nodes/scene-layer) | [ImageLayer](/en/creator-api/nodes/image-layer) | [AudioLayer](/en/creator-api/nodes/audio-layer)>

A promise that resolves to the new layer

#### Remarks

Use this form when `type` is only known at runtime. The result is a `SceneLayer` for `LOTTIE` and `SVG`, an `ImageLayer` for `IMAGE`, and an `AudioLayer` for `AUDIO`. The promise rejects if the import fails.
