Class Timeline
A horizontal time ruler with a draggable playhead and optional lanes of clips and keyframes.
Implements
Inherited Members
Namespace: Unity.AppUI.UI
Assembly: Unity.AppUI.dll
Syntax
[UxmlElement]
public class Timeline : BaseVisualElement, IEventHandler, IResolvedStyle, ITransform, ITransitionAnimations, IExperimentalFeatures, IVisualElementScheduler, IContextOverrideElement, IAdditionalDataHolder
Remarks
Timeline is a compound component. On its own it draws a ruler, a frame grid and a playhead over an empty strip; the lanes come from the TimelineTrack and TimelineTrackGroup children you add to it. Inside a track, TimelineClip and TimelineKeyframe place themselves on the shared time axis. TimelineMarkers are added through AddMarker(TimelineMarker) and float above every lane.
The time axis. pxPerUnit is the base scale and zoom is a multiplier on top of it; effectivePxPerUnit is their clamped product, and every part projects time through TimeToX(float). A fixed origin inset sits before time zero and a fixed endPadding after the last frame, so the strip is stripWidth wide. Panning translates the strip inside a clipping viewport rather than scrolling it, which keeps a zoom pivoted exactly on the cursor even under a burst of wheel events.
Layout constants come from the static sizing ramp. origin,
endPadding, defaultTrackHeight and defaultRulerHeight
are C# constants that also appear in Timeline.uss. They are bound to
--appui-static-sizing-*, which no density class overrides, so the arithmetic and the
rendering cannot drift apart under .appui--compact.
Interaction. controlScheme mirrors CanvasControlScheme: under Modern a bare wheel pans and Ctrl/Cmd + wheel zooms, under Editor the wheel always zooms and Alt + drag pans. Middle-drag pans under either. Dragging the ruler seeks; Shift + dragging it draws a range selection. The playhead is focusable and answers the arrow keys, Home and End.
Examples
A dope sheet built in UXML.
<appui:Timeline duration="60" label-width="120" px-per-unit="12">
<appui:TimelineTrack id="position" label="Position">
<appui:TimelineClip start="4" duration="12" label="Walk" />
<appui:TimelineKeyframe time="24" />
</appui:TimelineTrack>
<appui:TimelineTrackGroup id="cube" title="Cube">
<appui:TimelineTrack id="rotation" label="Rotation" />
</appui:TimelineTrackGroup>
</appui:Timeline>
The same thing in C#, with a marker and a seek handler.
var timeline = new Timeline { duration = 60f, labelWidth = 120f };
var track = new TimelineTrack { id = "position", label = "Position" };
track.Add(new TimelineClip );
timeline.Add(track);
timeline.AddMarker(new TimelineMarker );
timeline.valueChanged += t => player.time = t;
Constructors
Timeline()
Default constructor.
Declaration
public Timeline()
Fields
bodyUssClassName
The styling class of the row holding the gutter and the viewport.
Declaration
public const string bodyUssClassName = "appui-timeline__body"
Field Value
| Type | Description |
|---|---|
| string |
cornerSuffixUssClassName
The styling class of the fixed text after the corner time.
Declaration
public const string cornerSuffixUssClassName = "appui-timeline__corner-suffix"
Field Value
| Type | Description |
|---|---|
| string |
cornerTimeUssClassName
The styling class of the time shown in the gutter's corner.
Declaration
public const string cornerTimeUssClassName = "appui-timeline__corner-time"
Field Value
| Type | Description |
|---|---|
| string |
defaultMinLabelWidth
The default minLabelWidth, in pixels.
Declaration
public const float defaultMinLabelWidth = 96
Field Value
| Type | Description |
|---|---|
| float |
defaultPxPerUnit
The default base scale, in pixels per time unit.
Declaration
public const float defaultPxPerUnit = 8
Field Value
| Type | Description |
|---|---|
| float |
defaultRulerHeight
The default ruler row height, in pixels. Mirrors --appui-static-sizing-300.
Declaration
public const float defaultRulerHeight = 24
Field Value
| Type | Description |
|---|---|
| float |
defaultTrackHeight
The default lane height, in pixels. Mirrors --appui-static-sizing-400.
Declaration
public const float defaultTrackHeight = 32
Field Value
| Type | Description |
|---|---|
| float |
disabledUssClassName
The styling class applied while the Timeline is disabled.
Declaration
public const string disabledUssClassName = "appui-timeline--disabled"
Field Value
| Type | Description |
|---|---|
| string |
endPadding
The padding after the last frame, in pixels. Mirrors --appui-static-sizing-300.
Declaration
public const float endPadding = 24
Field Value
| Type | Description |
|---|---|
| float |
gutterChevronUssClassName
The styling class of a gutter group's expand chevron.
Declaration
public const string gutterChevronUssClassName = "appui-timeline__gutter-chevron"
Field Value
| Type | Description |
|---|---|
| string |
gutterGroupUssClassName
The styling class of a gutter row belonging to a TimelineTrackGroup header.
Declaration
public const string gutterGroupUssClassName = "appui-timeline__gutter-group"
Field Value
| Type | Description |
|---|---|
| string |
gutterLabelUssClassName
The styling class of the gutter row label.
Declaration
public const string gutterLabelUssClassName = "appui-timeline__gutter-label"
Field Value
| Type | Description |
|---|---|
| string |
gutterRowUssClassName
The styling class of one gutter row, mirroring one TimelineTrack.
Declaration
public const string gutterRowUssClassName = "appui-timeline__gutter-row"
Field Value
| Type | Description |
|---|---|
| string |
gutterSpacerUssClassName
The styling class of the gutter spacer that lines up with the ruler.
Declaration
public const string gutterSpacerUssClassName = "appui-timeline__gutter-spacer"
Field Value
| Type | Description |
|---|---|
| string |
gutterUssClassName
The styling class of the left gutter that shows lane labels.
Declaration
public const string gutterUssClassName = "appui-timeline__gutter"
Field Value
| Type | Description |
|---|---|
| string |
hoverLineUssClassName
The styling class of the guide line drawn at the pointer.
Declaration
public const string hoverLineUssClassName = "appui-timeline__hover-line"
Field Value
| Type | Description |
|---|---|
| string |
lanesUssClassName
The styling class of the container holding the lanes.
Declaration
public const string lanesUssClassName = "appui-timeline__lanes"
Field Value
| Type | Description |
|---|---|
| string |
markersUssClassName
The styling class of the layer holding the TimelineMarkers.
Declaration
public const string markersUssClassName = "appui-timeline__markers"
Field Value
| Type | Description |
|---|---|
| string |
maxEffectivePxPerUnit
The default upper bound on effectivePxPerUnit.
Declaration
public const float maxEffectivePxPerUnit = 80
Field Value
| Type | Description |
|---|---|
| float |
minEffectivePxPerUnit
The default lower bound on effectivePxPerUnit.
Declaration
public const float minEffectivePxPerUnit = 2
Field Value
| Type | Description |
|---|---|
| float |
minLanesWidth
The narrowest the lanes get when the gutter is widened, in pixels.
Declaration
public const float minLanesWidth = 120
Field Value
| Type | Description |
|---|---|
| float |
origin
The left inset before time zero, in pixels. Mirrors --appui-static-sizing-200.
Declaration
public const float origin = 16
Field Value
| Type | Description |
|---|---|
| float |
revealMargin
The gap the playhead keeps from the viewport edge when it pans into view, at most, in pixels.
Declaration
public const float revealMargin = 48
Field Value
| Type | Description |
|---|---|
| float |
sashKeyStep
How far one arrow key moves the gutter sash, in pixels.
Declaration
public const float sashKeyStep = 8
Field Value
| Type | Description |
|---|---|
| float |
sashUssClassName
The styling class of the gutter's resize sash.
Declaration
public const string sashUssClassName = "appui-timeline__sash"
Field Value
| Type | Description |
|---|---|
| string |
scrollbarUssClassName
The styling class of the overlay horizontal scrollbar.
Declaration
public const string scrollbarUssClassName = "appui-timeline__scrollbar"
Field Value
| Type | Description |
|---|---|
| string |
stripUssClassName
The styling class of the pannable inner strip.
Declaration
public const string stripUssClassName = "appui-timeline__strip"
Field Value
| Type | Description |
|---|---|
| string |
ussClassName
The Timeline main styling class.
Declaration
public const string ussClassName = "appui-timeline"
Field Value
| Type | Description |
|---|---|
| string |
viewportUssClassName
The styling class of the clipping viewport.
Declaration
public const string viewportUssClassName = "appui-timeline__viewport"
Field Value
| Type | Description |
|---|---|
| string |
Properties
adaptiveTicks
Whether the ruler and grid thin their ticks to a readable interval as the axis zooms. False by default; infinite implies it.
Declaration
[Tooltip("Whether the ruler and grid thin their ticks to a readable interval as the axis zooms.")]
[CreateProperty]
[UxmlAttribute]
public bool adaptiveTicks { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
Remarks
Off, the tick interval is whatever minorTick and majorTick say, which turns to mush once a zoomed-out axis puts those ticks a pixel apart. On, the interval is chosen from the current pixel density, stepping through 1, 2, 5, 10 and so on, so the spacing stays legible at any zoom.
contentContainer
Lanes are added here, so timeline.Add(track) puts the track where it belongs.
Declaration
public override VisualElement contentContainer { get; }
Property Value
| Type | Description |
|---|---|
| VisualElement |
Overrides
controlScheme
The wheel and drag interaction scheme.
Declaration
[Tooltip("The wheel and drag interaction scheme.")]
[CreateProperty]
[UxmlAttribute]
public TimelineControlScheme controlScheme { get; set; }
Property Value
| Type | Description |
|---|---|
| TimelineControlScheme |
cornerTime
The time shown in the gutter's corner.
Declaration
public LocalizedTextElement cornerTime { get; }
Property Value
| Type | Description |
|---|---|
| LocalizedTextElement |
disabled
Whether pointer interaction and keyboard seeking are off.
Declaration
[Tooltip("Whether pointer interaction and keyboard seeking are off.")]
[CreateProperty]
[UxmlAttribute]
public bool disabled { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
duration
The total length of the timeline, in time units.
Declaration
[Tooltip("The total length of the timeline, in time units.")]
[CreateProperty]
[UxmlAttribute]
public float duration { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
Remarks
A non-finite value (NaN or infinity, say from a field that parsed 1e309) has no
extent to lay out, pan over or scroll through, so it reads as an empty axis, the way the
registry treats it.
effectiveLabelWidth
The width the gutter actually renders at: labelWidth, raised to minLabelWidth when labelResizable is on, and capped at maxLabelWidth. Zero while the gutter is hidden.
Declaration
public float effectiveLabelWidth { get; }
Property Value
| Type | Description |
|---|---|
| float |
effectivePxPerUnit
The pixels per time unit every part actually projects through: pxPerUnit multiplied by zoom, clamped to the zoom range.
Declaration
public float effectivePxPerUnit { get; }
Property Value
| Type | Description |
|---|---|
| float |
fitDuration
The span the fitted view fills. Zero, the default, falls back to duration.
Declaration
[Tooltip("The span the fitted view fills. Zero falls back to the duration.")]
[CreateProperty]
[UxmlAttribute]
public float fitDuration { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
Remarks
For a strip that should open showing a window onto a longer timeline -- the first ten seconds of a two minute clip -- rather than the whole of it.
fitWidth
Whether the base scale fills the measured viewport rather than being a fixed pixels-per-unit. False by default.
Declaration
[Tooltip("Whether the base scale fills the measured viewport.")]
[CreateProperty]
[UxmlAttribute]
public bool fitWidth { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
Remarks
On, pxPerUnit is recomputed from the viewport width and fitDuration, so the content fills the strip at zoom 1 whatever the panel is sized to, and the zoom-out floor fills the width with the whole duration.
formatTime
The formatter used for ruler tick labels and the playhead bubble.
Declaration
public Func<float, string> formatTime { get; set; }
Property Value
| Type | Description |
|---|---|
| Func<float, string> |
Remarks
Defaults to the invariant numeric representation, matching the registry's String default.
Setting it to null restores that default.
grid
The built-in frame grid.
Declaration
public TimelineGrid grid { get; }
Property Value
| Type | Description |
|---|---|
| TimelineGrid |
gutter
The left gutter that shows lane labels.
Declaration
public VisualElement gutter { get; }
Property Value
| Type | Description |
|---|---|
| VisualElement |
hasSelection
Whether a range is currently selected.
Declaration
public bool hasSelection { get; }
Property Value
| Type | Description |
|---|---|
| bool |
hoverLine
Whether a hairline is drawn through the ruler and the lanes at the pointer while it is over the timeline. False by default.
Declaration
[Tooltip("Whether a hairline is drawn at the pointer while it is over the timeline.")]
[CreateProperty]
[UxmlAttribute]
public bool hoverLine { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
Remarks
A guide to read a position against, for a timeline that draws no grid lines. Over the origin inset it holds at time zero and, on a finite axis, past the end it holds at the end.
hoverLineElement
The hover guide line inside the viewport.
Declaration
public VisualElement hoverLineElement { get; }
Property Value
| Type | Description |
|---|---|
| VisualElement |
infinite
Whether the axis extends past duration into empty frames.
Declaration
[Tooltip("Whether the axis extends past the duration into empty frames.")]
[CreateProperty]
[UxmlAttribute]
public bool infinite { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
keySize
One glyph size for every key on the sheet. Auto, the default, draws muted keys small and the rest regular. A key's own size still wins.
Declaration
[Tooltip("One glyph size for every key on the sheet. Auto draws muted keys small.")]
[CreateProperty]
[UxmlAttribute]
public TimelineKeySize keySize { get; set; }
Property Value
| Type | Description |
|---|---|
| TimelineKeySize |
labelResizable
Whether the gutter has a sash on its right edge that resizes it. False by default.
Declaration
[Tooltip("Whether the gutter has a sash on its right edge that resizes it.")]
[CreateProperty]
[UxmlAttribute]
public bool labelResizable { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
Remarks
Dragging the sash, or pressing the left and right arrows on it (by sashKeyStep) and Home (to minLabelWidth), assigns labelWidth and raises labelWidthChanged, so a host that stores the width can persist it from there. The sash answers the primary button only.
labelWidth
The width of the left label gutter, in pixels. Zero, the default, hides the gutter.
Declaration
[Tooltip("The width of the left label gutter, in pixels. Zero hides it.")]
[CreateProperty]
[UxmlAttribute]
public float labelWidth { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
Remarks
This is the width asked for. The gutter renders at effectiveLabelWidth, which keeps at least minLanesWidth pixels for the lanes, so a width stored from a wider panel cannot swallow the lanes in a narrower one. With labelResizable on, it is also never under minLabelWidth.
laneExtent
How far along the axis the track lanes are drawn, in time units. Negative, the default, draws them to duration.
Declaration
[Tooltip("How far along the axis the track lanes are drawn. Negative draws them to the duration.")]
[CreateProperty]
[UxmlAttribute]
public float laneExtent { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
Remarks
The length of the thing being edited, when the axis is kept addressable a little past it so content can be dragged out and the length grown. It never reaches past duration. A TimelineTrack can end its own lane earlier with laneEnd.
majorTick
The spacing between major, labelled ruler ticks, in time units.
Declaration
[Tooltip("The spacing between major, labelled ruler ticks, in time units.")]
[CreateProperty]
[UxmlAttribute]
public float majorTick { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
maxLabelWidth
The widest the gutter may be: what leaves minLanesWidth for the lanes, never under minLabelWidth. Unbounded until the Timeline has been laid out.
Declaration
public float maxLabelWidth { get; }
Property Value
| Type | Description |
|---|---|
| float |
maxPxPerUnit
The zoom-in cap on effectivePxPerUnit. Defaults to maxEffectivePxPerUnit.
Declaration
[Tooltip("The zoom-in cap on the effective pixels per time unit.")]
[CreateProperty]
[UxmlAttribute]
public float maxPxPerUnit { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
minLabelWidth
The narrowest the sash can drag the gutter to, in pixels. With labelResizable on, a narrower positive labelWidth also renders at this width. Defaults to defaultMinLabelWidth.
Declaration
[Tooltip("The narrowest the sash can drag the gutter to, in pixels.")]
[CreateProperty]
[UxmlAttribute]
public float minLabelWidth { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
minPxPerUnit
The zoom-out floor on effectivePxPerUnit. Defaults to minEffectivePxPerUnit.
Declaration
[Tooltip("The zoom-out floor on the effective pixels per time unit.")]
[CreateProperty]
[UxmlAttribute]
public float minPxPerUnit { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
Remarks
With fitWidth on, the floor instead becomes whatever fills the viewport with the whole duration, so the axis never zooms out past the point where the content stops filling the strip.
minTickStep
The finest tick interval an adaptive axis may pick, in time units. Zero, the default, falls back to minorTick.
Declaration
[Tooltip("The finest tick interval an adaptive axis may pick. Zero falls back to minorTick.")]
[CreateProperty]
[UxmlAttribute]
public float minTickStep { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
Remarks
Active with adaptiveTicks or infinite. A seconds axis sets it
to 0.1, say, so zooming in subdivides a second into halves, fifths and tenths, each
finer level taking over once its ticks are far enough apart. Without it the adaptive axis
never goes finer than minorTick. The registry defaults it to 1, which
is minorTick's default, so the two agree out of the box.
minorTick
The spacing between minor ruler ticks, in time units.
Declaration
[Tooltip("The spacing between minor ruler ticks, in time units.")]
[CreateProperty]
[UxmlAttribute]
public float minorTick { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
offset
The pan offset, in pixels. The strip is translated by its negation inside the viewport.
Declaration
public float offset { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
playhead
The built-in playhead scrubber.
Declaration
public TimelinePlayhead playhead { get; }
Property Value
| Type | Description |
|---|---|
| TimelinePlayhead |
pxPerUnit
The base horizontal scale, in pixels per time unit. zoom multiplies it.
Declaration
[Tooltip("The base horizontal scale, in pixels per time unit.")]
[CreateProperty]
[UxmlAttribute]
public float pxPerUnit { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
range
The built-in range selection band.
Declaration
public TimelineRange range { get; }
Property Value
| Type | Description |
|---|---|
| TimelineRange |
resolvedLaneExtent
The lane extent actually drawn: laneExtent, or the duration, never past it.
Declaration
public float resolvedLaneExtent { get; }
Property Value
| Type | Description |
|---|---|
| float |
ruler
The built-in time ruler.
Declaration
public TimelineRuler ruler { get; }
Property Value
| Type | Description |
|---|---|
| TimelineRuler |
rulerHeight
The ruler row height, in pixels.
Declaration
[Tooltip("The ruler row height, in pixels.")]
[CreateProperty]
[UxmlAttribute]
public float rulerHeight { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
sash
The sash on the gutter's right edge. Hidden unless labelResizable.
Declaration
public VisualElement sash { get; }
Property Value
| Type | Description |
|---|---|
| VisualElement |
scrollbar
The overlay horizontal scrollbar. Hidden while everything fits or the axis is infinite.
Declaration
public Scroller scrollbar { get; }
Property Value
| Type | Description |
|---|---|
| Scroller |
selection
The current range selection, or null when nothing is selected.
Declaration
public TimelineSelection? selection { get; set; }
Property Value
| Type | Description |
|---|---|
| TimelineSelection? |
showFrameLines
Whether the faint per-frame guide lines are drawn across the lanes.
Declaration
[Tooltip("Whether the faint per-frame guide lines are drawn across the lanes.")]
[CreateProperty]
[UxmlAttribute]
public bool showFrameLines { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
step
The playhead snap increment, in time units. Zero seeks continuously.
Declaration
[Tooltip("The playhead snap increment, in time units. Zero seeks continuously.")]
[CreateProperty]
[UxmlAttribute]
public float step { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
strip
The pannable inner strip that holds every part.
Declaration
public VisualElement strip { get; }
Property Value
| Type | Description |
|---|---|
| VisualElement |
stripWidth
The full width of the strip: the origin inset, the projected duration and the end padding.
Declaration
public float stripWidth { get; }
Property Value
| Type | Description |
|---|---|
| float |
ticksAt
Which edge of the ruler the ticks hang from. Bottom by default.
Declaration
[Tooltip("Which edge of the ruler the ticks hang from.")]
[CreateProperty]
[UxmlAttribute]
public TimelineTicksAt ticksAt { get; set; }
Property Value
| Type | Description |
|---|---|
| TimelineTicksAt |
timeLabel
The formatter for the time shown in the gutter's corner, above the labels. null, the
default, shows no time.
Declaration
public Func<float, string> timeLabel { get; set; }
Property Value
| Type | Description |
|---|---|
| Func<float, string> |
Remarks
While the pointer is over the timeline the corner shows the pointer's time, snapped to step like the time a click there seeks to; otherwise the playhead's. The corner is the gutter's, so it needs a positive labelWidth to show.
timeSuffix
Fixed text drawn after the corner time, the length it is read against for instance
(/ 2.00s). Shown only with a timeLabel.
Declaration
[Tooltip("Fixed text drawn after the corner time.")]
[CreateProperty]
[UxmlAttribute]
public string timeSuffix { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
trackCount
The number of lanes — TimelineTracks and TimelineTrackGroups.
Declaration
public int trackCount { get; }
Property Value
| Type | Description |
|---|---|
| int |
trackHeight
The default lane height, in pixels. A TimelineTrack can override it.
Declaration
[Tooltip("The default lane height, in pixels.")]
[CreateProperty]
[UxmlAttribute]
public float trackHeight { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
value
The playhead position, in time units.
Declaration
[Tooltip("The playhead position, in time units.")]
[CreateProperty]
[UxmlAttribute]
public float value { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
Remarks
Assigning is clamped to [0, duration] and snapped to step, so what you
read back is always a position the playhead can actually occupy.
viewport
The clipping viewport that the strip pans inside.
Declaration
public VisualElement viewport { get; }
Property Value
| Type | Description |
|---|---|
| VisualElement |
zoom
The zoom multiplier applied on top of pxPerUnit.
Declaration
[Tooltip("The zoom multiplier applied on top of pxPerUnit.")]
[CreateProperty]
[UxmlAttribute]
public float zoom { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
Remarks
The product is clamped between minEffectivePxPerUnit and maxEffectivePxPerUnit, so a very large or very small zoom saturates rather than collapsing the axis. Read effectivePxPerUnit for the value the parts actually project through.
Methods
AddMarker(TimelineMarker)
Add a TimelineMarker to the marker layer, above every lane.
Declaration
public void AddMarker(TimelineMarker marker)
Parameters
| Type | Name | Description |
|---|---|---|
| TimelineMarker | marker | The marker. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | The marker can't be null. |
ClearMarkers()
Remove every TimelineMarker.
Declaration
public void ClearMarkers()
RefreshAxis()
Re-publish the time axis to every part. Call it after mutating several properties at once if you need the parts refreshed before the next layout pass.
Declaration
public void RefreshAxis()
RefreshGutter()
Rebuild the gutter rows so each one lines up with the lane it names.
Declaration
public void RefreshGutter()
Remarks
This runs automatically whenever the lanes change or the axis is refreshed. A group contributes a header row carrying its expand chevron, followed by one row per child track while it is expanded.
RevealTime(float)
Pan so a time is in view, keeping a margin from the viewport edge. Does nothing when the time is already in view.
Declaration
public void RevealTime(float t)
Parameters
| Type | Name | Description |
|---|---|---|
| float | t | The time to bring into view, in time units. |
Remarks
The playhead calls this when the keyboard moves it, so a playhead sent to End is not left off-screen. Assigning value from code does not pan.
SnapTime(float)
Clamp a time to [0, duration] and snap it to step.
Declaration
public float SnapTime(float t)
Parameters
| Type | Name | Description |
|---|---|---|
| float | t | The raw time. |
Returns
| Type | Description |
|---|---|
| float | A time the playhead can occupy. |
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. |
ViewportXToTime(float)
Project an x coordinate inside the viewport onto a time, accounting for the pan offset.
Declaration
public float ViewportXToTime(float viewportX)
Parameters
| Type | Name | Description |
|---|---|---|
| float | viewportX | The x coordinate, in pixels, relative to the viewport's left edge. |
Returns
| Type | Description |
|---|---|
| float | The time, in time units. |
XToTime(float)
Project an x coordinate inside the strip back onto a time. The exact inverse of TimeToX(float).
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. |
ZoomAt(float, float)
Zoom about a point, keeping the time under that point fixed.
Declaration
public void ZoomAt(float viewportX, float factor)
Parameters
| Type | Name | Description |
|---|---|---|
| float | viewportX | The pivot, in pixels, relative to the viewport's left edge. |
| float | factor | The multiplier to apply to zoom. |
Events
axisChanged
Raised whenever the time axis changes: scale, zoom or pan.
Declaration
public event Action axisChanged
Event Type
| Type | Description |
|---|---|
| Action |
labelWidthChanged
Raised whenever the gutter sash resizes the gutter, live during a drag and once per key press. Carries the new labelWidth.
Declaration
public event Action<float> labelWidthChanged
Event Type
| Type | Description |
|---|---|
| Action<float> |
selectionChanged
Raised whenever the range selection changes. Carries null when it is cleared.
Declaration
public event Action<TimelineSelection?> selectionChanged
Event Type
| Type | Description |
|---|---|
| Action<TimelineSelection?> |
valueChanged
Raised whenever the playhead moves. Carries the new time.
Declaration
public event Action<float> valueChanged
Event Type
| Type | Description |
|---|---|
| Action<float> |