Class TimelineAxisContext
The time-axis state a Timeline publishes to its parts.
Inherited Members
Namespace: Unity.AppUI.UI
Assembly: Unity.AppUI.dll
Syntax
public record TimelineAxisContext : IContext, IEquatable<TimelineAxisContext>
Remarks
Every part — the ruler, the grid, tracks, clips, keyframes, markers, the range band and the
playhead — projects time onto pixels through this record rather than reaching for its parent.
It is a record, so an unchanged axis raises no callback and nothing re-lays-out for free.
This is the same shape ListBox uses to hand a SizeContext down to its
rows.
Constructors
TimelineAxisContext(Timeline, float, float, float, float, float, float, float, float, float, bool, TimelineSelection?, float, TimelineKeySize)
The time-axis state a Timeline publishes to its parts.
Declaration
public TimelineAxisContext(Timeline owner, float duration, float pxPerUnit, float origin, float value, float step, float minorTick, float majorTick, float trackHeight, float rulerHeight, bool disabled, TimelineSelection? selection, float laneExtent = -1, TimelineKeySize keySize = TimelineKeySize.Auto)
Parameters
| Type | Name | Description |
|---|---|---|
| Timeline | owner | The Timeline publishing the axis. |
| float | duration | The total length in time units. |
| float | pxPerUnit | The effective pixels per time unit, base multiplied by zoom. |
| float | origin | The left inset before time zero, in pixels. |
| float | value | The playhead position, in time units. |
| float | step | The playhead snap increment. Zero means continuous. |
| float | minorTick | The minor tick spacing, in time units. |
| float | majorTick | The major (labelled) tick spacing, in time units. |
| float | trackHeight | The default lane height, in pixels. |
| float | rulerHeight | The ruler row height, in pixels. |
| bool | disabled | Whether interaction is off. |
| TimelineSelection? | selection | The current range selection, if any. |
| float | laneExtent | The default lane end, in time units. Negative means the full duration. |
| TimelineKeySize | keySize | The default keyframe size for every track. |
Remarks
Every part — the ruler, the grid, tracks, clips, keyframes, markers, the range band and the
playhead — projects time onto pixels through this record rather than reaching for its parent.
It is a record, so an unchanged axis raises no callback and nothing re-lays-out for free.
This is the same shape ListBox uses to hand a SizeContext down to its
rows.
Properties
disabled
Whether interaction is off.
Declaration
public bool disabled { get; }
Property Value
| Type | Description |
|---|---|
| bool |
duration
The total length in time units.
Declaration
public float duration { get; }
Property Value
| Type | Description |
|---|---|
| float |
keySize
The glyph size every key defers to.
Declaration
public TimelineKeySize keySize { get; }
Property Value
| Type | Description |
|---|---|
| TimelineKeySize |
laneExtent
How far along the axis the lanes are drawn, in time units. Negative reads as the duration.
Declaration
public float laneExtent { get; }
Property Value
| Type | Description |
|---|---|
| float |
majorTick
The major (labelled) tick spacing, in time units.
Declaration
public float majorTick { get; }
Property Value
| Type | Description |
|---|---|
| float |
minorTick
The minor tick spacing, in time units.
Declaration
public float minorTick { get; }
Property Value
| Type | Description |
|---|---|
| float |
origin
The left inset before time zero, in pixels.
Declaration
public float origin { get; }
Property Value
| Type | Description |
|---|---|
| float |
owner
The Timeline publishing the axis.
Declaration
public Timeline owner { get; }
Property Value
| Type | Description |
|---|---|
| Timeline |
pxPerUnit
The effective pixels per time unit, base multiplied by zoom.
Declaration
public float pxPerUnit { get; }
Property Value
| Type | Description |
|---|---|
| float |
rulerHeight
The ruler row height, in pixels.
Declaration
public float rulerHeight { get; }
Property Value
| Type | Description |
|---|---|
| float |
selection
The current range selection, if any.
Declaration
public TimelineSelection? selection { get; }
Property Value
| Type | Description |
|---|---|
| TimelineSelection? |
step
The playhead snap increment. Zero means continuous.
Declaration
public float step { get; }
Property Value
| Type | Description |
|---|---|
| float |
trackHeight
The default lane height, in pixels.
Declaration
public float trackHeight { get; }
Property Value
| Type | Description |
|---|---|
| float |
value
The playhead position, in time units.
Declaration
public float value { get; }
Property Value
| Type | Description |
|---|---|
| float |
Methods
TimeToX(float)
Project a time onto an x coordinate inside the strip.
Declaration
public float TimeToX(float t)
Parameters
| Type | Name | Description |
|---|---|---|
| float | t | The time, in time units. |
Returns
| Type | Description |
|---|---|
| float | The x coordinate, in pixels, relative to the strip's left edge. |
XToTime(float)
Project an x coordinate inside the strip back onto a time.
Declaration
public float XToTime(float x)
Parameters
| Type | Name | Description |
|---|---|---|
| float | x | The x coordinate, in pixels, relative to the strip's left edge. |
Returns
| Type | Description |
|---|---|
| float | The time, in time units. |