---
title: "Zoom a simulation replay timeline around a tick"
url: https://recursiveai.org/onescope/cookbook/zoom-replay-timeline-around-a-tick/
description: "Zoom in on a short interval in a simulation replay with OneScope. Read the visible tick range before and after zooming without moving the cursor."
version: "1.0.0"
---

# Zoom a simulation replay timeline around a tick

**OneScope** is a free, open-source viewer for simulation recordings, with a desktop window or command-line control, from Recursive AI. MIT or Apache-2.0.

[NuGet](https://www.nuget.org/packages/RecursiveAI.OneScope.Tool) · [GitHub](https://github.com/recursive-ai-oss/onescope-csharp) · [Docs](https://recursiveai.org/onescope/docs/) · [Download example (.zip)](https://recursiveai.org/onescope/cookbook/zoom-replay-timeline-around-a-tick/zoom-replay-timeline-around-a-tick.zip)

Use `timeline` on `run.oppr` from the zip. Headless mode still needs a graphics driver.

```shell
dotnet tool install --global RecursiveAI.OneScope.Tool
```

Requires [.NET 10](https://dotnet.microsoft.com/download/dotnet/10.0) (net10.0); .NET 9 and earlier aren’t supported.

```shell
onescope open run.oppr --headless \
  --run 'seek {"step":500}' \
  --run timeline \
  --run 'timeline {"zoom":8,"center":600}'
```

Or unzip the example and run `dotnet run` to get the same result from C#.

`--headless` renders without a display. On Linux CI without a GPU, you can use Mesa’s lavapipe Vulkan software driver, as OneScope’s own tests do.

After the open and seek records, the two `timeline` calls print:

```json
{"from":0,"to":1200,"zoomed":false,"axisFrom":0,"axisTo":1200,"step":500}
{"from":525,"to":675,"zoomed":true,"axisFrom":0,"axisTo":1200,"step":500}
```

## The full program

The included binary recording shows a circle falling onto flat ground in a 2D physics world. It spans tick 0 through tick 1,200. The console program installs the pinned OneScope tool into `obj/`, runs the commands above, and prints just the visible ranges and cursor values.

```csharp
using System.Diagnostics;
using System.Text.Json;

string tools = Path.GetFullPath("obj/scope-tool");
string executable = Path.Combine(tools,
    OperatingSystem.IsWindows() ? "onescope.exe" : "onescope");
if (!File.Exists(executable))
    Run("dotnet", "tool", "install", "RecursiveAI.OneScope.Tool",
        "--version", "1.0.0", "--tool-path", tools);

string output = Run(executable, "open", "run.oppr", "--headless",
    "--run", "seek {\"step\":500}",
    "--run", "timeline",
    "--run", "timeline {\"zoom\":8,\"center\":600}");

string[] lines = output.Split('\n', StringSplitOptions.RemoveEmptyEntries);
PrintRange("Before", lines[2]);
PrintRange("After", lines[3]);

static void PrintRange(string label, string json)
{
    using var doc = JsonDocument.Parse(json);
    var range = doc.RootElement;
    long from = range.GetProperty("from").GetInt64();
    long to = range.GetProperty("to").GetInt64();
    long tick = range.GetProperty("step").GetInt64();
    Console.WriteLine($"{label}: {from}–{to}; cursor: {tick}");
}

static string Run(string command, params string[] args)
{
    var start = new ProcessStartInfo(command)
    {
        RedirectStandardOutput = true,
        UseShellExecute = false
    };
    foreach (string arg in args) start.ArgumentList.Add(arg);
    using var process = Process.Start(start)!;
    string output = process.StandardOutput.ReadToEnd();
    process.WaitForExit();
    if (process.ExitCode != 0)
        throw new InvalidOperationException(output);
    return output;
}
```

```text
Before: 0–1200; cursor: 500
After: 525–675; cursor: 500
```

If the zoom factor isn’t positive, the operation returns `bad_args` instead of changing the view.

## Variations

Add this last line to the command, with a `\` at the end of the preceding line, to return to the whole timeline:

```shell
--run 'timeline {"fit":"all"}'
```

```json
{"from":0,"to":1200,"zoomed":false,"axisFrom":0,"axisTo":1200,"step":500}
```

## Related recipes

- [Seek a simulation replay to a specific tick](https://recursiveai.org/onescope/cookbook/seek-simulation-replay-to-step/)
- [Align replays with different start ticks](https://recursiveai.org/onescope/cookbook/align-replays-with-different-start-ticks/)

## The short answer

Call `timeline` with `zoom` greater than 1 and set `center` to the tick you want to zoom around. Compare the resulting `from` and `to` with the range from a plain `timeline` call. The `step` field is the replay cursor; it doesn’t change, even if it lies outside the new view.

## How does zooming a replay timeline differ from seeking?

Zooming changes how much of the timeline fits in the panel. Seeking changes the simulation state the viewer displays. In the example, zooming around tick 600 shrinks the visible window from 1,200 tick intervals to 150. Tick 600 stays visible, but the cursor remains at tick 500. Use a separate seek only if you want to inspect the world at another tick.

Zoom works around an anchor, not necessarily the midpoint of the new window. A tick a quarter of the way across the old view stays roughly a quarter of the way across the new one, subject to rounding and the ends of the replay. Omit `center` to use the replay cursor as the anchor. In the desktop window, the wheel zooms around the pointer; clicking the timeline seeks to the tick under the pointer. **Fit all** restores the full range without seeking.
