---
title: "phase"
description: "How far through a repeating cycle the clock is, 0..1."
group: "space"
groupTitle: "Shapes, frames & warps"
categoryId: "motion"
categorySlug: "motion"
categoryTitle: "Motion & timing"
kind: "function"
sourceUrl: "https://github.com/shader-effects-inc/shaders/blob/main/packages/core/src/std/motion.ts#L36"
---

# phase

How far through a repeating cycle the clock is, 0..1.

```ts
phase(t: Expr, period: Expr | number): Expr
```

Import `motion` from `shaders/std` and use `motion.phase`.

`period` is the cycle length in seconds. The value ramps from 0 to 1 and snaps back.

## Parameters

| Name | Type | Notes |
|---|---|---|
| `t` | `Expr` |  |
| `period` | `Expr \| number` |  |

## Example

```ts
const sweep = motion.phase(animatedTime(params), params.uniforms.period)
```

## See also

- [`cycle`](/docs/primitives/motion/cycle) — A repeating cycle as two numbers: `progress` (0..1 through the current cycle) and `index` (which cycle this is).
- [`oscillate`](/docs/primitives/motion/oscillate) — A smooth back-and-forth between `min` and `max`.