> 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/blending-tracks.md).

# Blending Tracks

Blending tracks together is a great way to add complexity to your scripts without having to write too much code. You can use the `blend` key in the `clips` array to set the blend mode for any clip. In the example below, we add a screen layer on top of our entire composition.

```javascript
import * as hypno from './stl.js'

// Screen Blend Demo

const mainTrack = composition.track("main")
const screenTrack = composition.track("screen")

hypno.buildTimeline({

    fps: 30,
    resolution: new Vector(960, 1280),
    clips: [
        {
            // we're going to omit the asset key so the 
            // track defaults to the camera input
            start: 0,
            duration: 30,
            track: mainTrack
        },
        {
            start: 90,
            duration: 80,
            track: mainTrack
        },
        {
            start: 43,
            duration: 40,
            track: mainTrack
        },
        {
            start: 55,
            duration: 50,
            track: mainTrack
        },
        {
            start: 0,
            duration: 200,
            track: screenTrack,
            asset: new Asset("./filmGrain.mp4"),
            blend: hypno.blend.screen
        }
    ]
})
```

Here's what the timeline looks like for the script above in Nyx.

![](/files/-M1WQhjOXvlsJTSxb0ys)

And, here's the output:&#x20;

{% embed url="<https://vimeo.com/398074125/f86f0ad2b1>" %}

{% file src="/files/-M1WQv9m5VmeEbZOIDd7" %}

Hypno script supports most commonly used blend modes, and you can find a full list [here](/cloud/scripts-1/advanced-scripting/standard-library-full-documentation.md#clips).

Now, let's move to a more complicated example to review some sequencing techniques. Say, for example, you only want to have a blend over the second and fourth clips on the `mainTrack` of your composition. And, let's assume you want to use different sources as the blend layer at different points in the script. In this case, you could make two clips on the `screenTrack` , give each a different asset, and line them up with the second and fourth clips using `insert`.&#x20;

```javascript
import * as hypno from './stl.js'

// Blend Demo 2

const mainTrack = composition.track("main")
const screenTrack = composition.track("screen")

hypno.buildTimeline({

    fps: 30,
    resolution: new Vector(960, 1280),
    clips: [
        {
            // we're going to omit the asset key so the 
            // track defaults to the camera input
            start: 0,
            duration: 30,
            track: mainTrack
        },
        {
            start: 90,
            duration: 80,
            track: mainTrack
        },
        {
            start: 30,
            duration: 40,
            track: mainTrack
        },
        {
            start: 0,
            duration: 50,
            track: mainTrack
        },
        {
            start: 0,
            duration: 80, //the same as the second clip on the mainTrack
            insert: 30, // where the second clip starts
            track: screenTrack,
            asset: new Asset("./filmGrain.mp4"),
            blend: hypno.blend.screen
        },
        {
            start: 0,
            duration: 50, //same as the fourth clip on the mainTrack
            insert: 150, //where the fourth clip starts
            track: screenTrack,
            asset: new Asset("./lightLeaks.mp4"),
            blend: hypno.blend.screen
        }
    ]
})
```

Here's what the timeline & output look like for this example:

![](/files/-M1WS415uETTzI6vWQSs)

{% file src="/files/-M1WT8Kal9Rk6gUC0D-P" %}
