---
title: "fallingStreaks"
description: "Streaks that fall across the canvas in columns, each column at its own random speed."
group: "paint"
groupTitle: "Painting"
categoryId: "patterns"
categorySlug: "patterns"
categoryTitle: "Patterns & tiling"
kind: "function"
sourceUrl: "https://github.com/shader-effects-inc/shaders/blob/main/packages/core/src/std/paint/patterns.ts#L511"
---

# fallingStreaks

Streaks that fall across the canvas in columns, each column at its own random speed.

```ts
fallingStreaks(slots: {
    angle: PropRef
    density: PropRef
    speedVariance: PropRef
    trailLength: PropRef
    strokeWidth: PropRef
    rounding: PropRef
    balance: PropRef
}): {mask: PatternPaint; fade: PatternPaint}
```

Import `patterns` from `shaders/std` and use `patterns.fallingStreaks`.

Returns two values: `mask` is the streak coverage, and `fade` runs from 0 at the tail to 1 at the leading edge, for a color ramp along each streak. `angle` is in degrees (90 falls down, 0 moves right). `density` is the number of columns across the canvas. `speedVariance` 0–1 spreads the per-column speeds. `trailLength` 0–1 is the streak length as a fraction of the spacing. `strokeWidth` 0–1 is the width as a fraction of a column. `rounding` 0–1 rounds the leading cap. `balance` 0–1 moves the midpoint of `fade`. Declare `animatedTime: {speed: 'speed'}` on the definition.

## Parameters

| Name | Type | Notes |
|---|---|---|
| `slots` | `{
    angle: PropRef
    density: PropRef
    speedVariance: PropRef
    trailLength: PropRef
    strokeWidth: PropRef
    rounding: PropRef
    balance: PropRef
}` |  |

## Example

```ts
const streaks = fallingStreaks({angle: p('angle'), density: p('density'), speedVariance: p('speedVariance'), trailLength: p('trailLength'), strokeWidth: p('strokeWidth'), rounding: p('rounding'), balance: p('balance')})
const streakColor = strokeOver({fill: p('trailColor'), stroke: p('leadColor'), mask: streaks.fade, space: p('colorSpace')})
// paint: withAlpha(streakColor, times(alphaOf(streakColor), streaks.mask))
```

## See also

- [`stripeBands`](/docs/primitives/patterns/stripebands) — A mask of straight parallel stripes that scroll with the layer's clock.
- [`dotLattice`](/docs/primitives/patterns/dotlattice) — A mask of round dots on a square grid, with optional row stagger, drift and twinkle.
- [`withAlpha`](/docs/primitives/patterns/withalpha) — A color with its alpha replaced by a separately built mask.

## Used by

[FallingLines](/docs/components/fallinglines)