> For the complete documentation index, see [llms.txt](https://capsule-video.gitbook.io/cloud/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://capsule-video.gitbook.io/cloud/scripts-1/scripting-basics/sequencing.md).

# Sequencing

`clips[]` is an array of objects passed to `hypno.buildTimeline`, each containing keys that determine clip parameters. This is where you will set up everything that goes into your script's video sequence. Let's review what we need to do before adding clips:

**1) Create your track(s)**

```javascript
const mainTrack = composition.track("mainTrack")
```

You will fill in your tracks with `clips` in `hypno.buildTimeline`.

**2) Call** `hypno.buildTimeline` **& configure your timeline**

```javascript
const mainTrack = composition.track("mainTrack")

hypno.buildTimeline({
    fps: 30,
    resolution: new Vector(1080, 1920) //dimensions of script output
})
```

### The **`clips[]`** Array

**`start` & `duration` (required)**

The clip object can take in a variety of parameters, but we'll start with the two required keys: `start` and `duration`. `start` indicates the clip's "in point", which sets the clip's offset (in frames) from the beginning of the media item. So, `start = 30` means the clip will start at 30 frames (1 second in 30 fps) in from the beginning of the media asset it is grabbing from. `duration` determines the length of the clip in frames.

```javascript
const mainTrack = composition.track("mainTrack")

hypno.buildTimeline({
    fps: 30,
    resolution: new Vector(960, 1280), //dimensions of script output
    clips: [
        {
            start: 30,
            duration: 100
        }
    ]
})
```

**`track` & `asset`**

The `track` key determines which track in your sequence the clip will be on. The `asset` key determines the media asset for the clip. Hypno tracks don't have a specific media type, so you can add clips with both image and video assets to the same track. If you don't provide a clip with a track key, it will be automatically assigned to a default track, and  if you don't provide the asset key, it will use the camera input as its media asset.&#x20;

The example below plays a video intro, then two camera clips, then shows an end card image, using one track for all of the clips.

```javascript
const mainTrack = composition.track("mainTrack")

hypno.buildTimeline({
    fps: 30,
    resolution: new Vector(960, 1280), //dimensions of script output
    clips: [
        {
            start: 0,
            duration: 30,
            asset: new Asset("./intro.mp4"),
            track: mainTrack
        },
        {
            start: 100,
            duration: 60,
            track: mainTrack
        },
        {
            start: 0,
            duration: 60,
            track: mainTrack
        },
        {
            start: 0,
            duration: 30,
            asset: new Image("./endCard.png"),
            track: mainTrack
        }
    ]
})
```

Here's what this video output looks like in Nyx:

{% embed url="<https://vimeo.com/398611593/6cb7b4c75d>" %}

**`insert` & `speed`**

These are two useful but optional keys that can be used for sequencing. `insert` gives the position (in frames) to insert this clip in the timeline, and, as we see above, leaving this value off assumes this clip immediately follows the previous clip on the same track. `speed` is straightforward and just determines the speed of playback for a clip.&#x20;

```javascript
hypno.buildTimeline({
    ...
    
    clips = [
        
        {
            start: 0,
            duration: 100,
            insert: 60, // inserts the clip at the 60 frame position
            speed: 0.5, // playback at 50% (slo-mo) 
            track: mainTrack
        }
        
        ...
    ]
})
```

For more information on the capabilities of the clip array, head to the [full documentation](/cloud/scripts-1/advanced-scripting/standard-library-full-documentation.md) in the Advanced Scripting section.
