> For the complete documentation index, see [llms.txt](https://pahutyakv.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://pahutyakv.gitbook.io/docs/delayed/frame-based-actions.md).

# Frame-Based Actions

The `Delayed.Frames` module executes actions after a specific number of frames or repeatedly at a frame interval. These are ideal for scenarios where timing should be tied to frames rather than real-world seconds, such as animation steps, physics updates, or frame-dependent logic.

***

### <mark style="color:$success;">Methods</mark>

<details>

<summary><strong>After(int frames, Action callback)</strong></summary>

Executes the `callback` after the specified number of `frames`.

```csharp
Delayed.Frames.After(60, () => Debug.Log("60 frames passed!"));
```

</details>

<details>

<summary><strong>Every(int frames, Action callback, int repeats = -1)</strong></summary>

Executes the `callback` repeatedly at a frame interval.\
Do not specify an interval to repeat the action every frame.

```csharp
Delayed.Frames.Every(10, () => Debug.Log("Tick!"), 3);
```

</details>

<details>

<summary><strong>Next(Action callback)</strong></summary>

Executes the `callback` on the next frame.

```csharp
Delayed.Frames.Next(() => Debug.Log("Next frame!"));
```

</details>

<details>

<summary><strong>Interpolate(int frames, Action onTick)</strong></summary>

Invokes `onTick` every frame with normalized progress (0 → 1) over the specified number of `frames`

```csharp
Delayed.Frames.Interpolate(80, progress => value = Mathf.Lerp(0, 100, progress));
```

</details>

***

### <mark style="color:$primary;">Notes</mark>

* Infinite repeats: `repeats = -1`.
* Useful for logic that must execute exactly after a number of frames or for synchronizing frame-dependent sequences.
* Can be combined with `DelayedChain` for sequential frame-based workflows.
