Class TimelineClip
A range bar on a TimelineTrack.
Inheritance
Implements
Inherited Members
Namespace: Unity.AppUI.UI
Assembly: Unity.AppUI.dll
Syntax
[UxmlElement]
public class TimelineClip : TimelinePart, IEventHandler, IResolvedStyle, ITransform, ITransitionAnimations, IExperimentalFeatures, IVisualElementScheduler, IContextOverrideElement, IAdditionalDataHolder
Remarks
Drag the body to move the clip and either edge to resize it. Both gestures snap to the
Timeline's step and are clamped inside [0, duration], and a
resize never takes the clip below minDuration. The geometry is committed once on
release through changed, not on every pointer tick, so one drag is one edit;
dragMove reports the live geometry in between for previews.
Examples
var clip = new TimelineClip { start = 4f, duration = 12f, label = "Walk" };
clip.changed += (start, duration) => Persist(start, duration);
track.Add(clip);
Constructors
TimelineClip()
Default constructor.
Declaration
public TimelineClip()
Fields
defaultMinDuration
The smallest duration a resize will leave, in time units.
Declaration
public const float defaultMinDuration = 0.5
Field Value
| Type | Description |
|---|---|
| float |
dragHandleIconUssClassName
The styling class of the icon inside a handle-variant clip's drag handle.
Declaration
public const string dragHandleIconUssClassName = "appui-timeline__clip-drag-handle-icon"
Field Value
| Type | Description |
|---|---|
| string |
dragHandleUssClassName
The styling class of a frame clip's drag handle strip.
Declaration
public const string dragHandleUssClassName = "appui-timeline__clip-drag-handle"
Field Value
| Type | Description |
|---|---|
| string |
edgeUssClassName
The styling class of a clip resize edge.
Declaration
public const string edgeUssClassName = "appui-timeline__clip-edge"
Field Value
| Type | Description |
|---|---|
| string |
fillUssClassName
The styling class of a frame clip's translucent body.
Declaration
public const string fillUssClassName = "appui-timeline__clip-fill"
Field Value
| Type | Description |
|---|---|
| string |
frameColorUssClassName
The styling class prefix carrying a frame clip's hue.
Declaration
public const string frameColorUssClassName = "appui-timeline__clip--frame-"
Field Value
| Type | Description |
|---|---|
| string |
frameUssClassName
The styling class applied while the clip is a placement frame.
Declaration
public const string frameUssClassName = "appui-timeline__clip--frame"
Field Value
| Type | Description |
|---|---|
| string |
labelUssClassName
The styling class of the clip's label.
Declaration
public const string labelUssClassName = "appui-timeline__clip-label"
Field Value
| Type | Description |
|---|---|
| string |
maxFrameHandleHeight
The tallest a frame clip's handle strip gets, in pixels.
Declaration
public const float maxFrameHandleHeight = 22
Field Value
| Type | Description |
|---|---|
| float |
ussClassName
The TimelineClip main styling class.
Declaration
public const string ussClassName = "appui-timeline__clip"
Field Value
| Type | Description |
|---|---|
| string |
variantUssClassName
The styling class prefix carrying the clip's variant.
Declaration
public const string variantUssClassName = "appui-timeline__clip--"
Field Value
| Type | Description |
|---|---|
| string |
Properties
color
The bar fill. Unset falls back to the track colour, then to the stylesheet.
Declaration
[Tooltip("The bar fill. Unset falls back to the track colour.")]
[CreateProperty]
[UxmlAttribute]
public Optional<Color> color { get; set; }
Property Value
| Type | Description |
|---|---|
| Optional<Color> |
draggable
Whether dragging the body moves the clip.
Declaration
[Tooltip("Whether dragging the body moves the clip.")]
[CreateProperty]
[UxmlAttribute]
public bool draggable { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
duration
The clip's length, in time units.
Declaration
[Tooltip("The clip's length, in time units.")]
[CreateProperty]
[UxmlAttribute]
public float duration { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
frame
Whether the clip renders as a translucent placement frame.
Declaration
[Tooltip("Whether the clip renders as a translucent placement frame.")]
[CreateProperty]
[UxmlAttribute]
public bool frame { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
Remarks
A frame marks where something sits without claiming the lane the way a solid clip does: the body is translucent and pointer-transparent, so a click passes through to the lane behind it, and only the handle strip along the top drags the frame.
frameColor
The hue a frame clip takes. Purple by default.
Declaration
[Tooltip("The hue a frame clip takes.")]
[CreateProperty]
[UxmlAttribute]
public TimelineFrameColor frameColor { get; set; }
Property Value
| Type | Description |
|---|---|
| TimelineFrameColor |
frameHeight
An explicit height for a frame clip, in pixels, drawn from the lane top. Zero, the default, fills the lane.
Declaration
[Tooltip("An explicit height for a frame clip, in pixels. Zero fills the lane.")]
[CreateProperty]
[UxmlAttribute]
public float frameHeight { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
Remarks
The handle strip is the smaller of this and maxFrameHandleHeight, so a tall frame does not turn its whole body into a drag surface.
label
The text drawn inside the bar.
Declaration
[Tooltip("The text drawn inside the bar.")]
[CreateProperty]
[UxmlAttribute]
public string label { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
minDuration
The smallest duration a resize will leave, in time units.
Declaration
[Tooltip("The smallest duration a resize will leave, in time units.")]
[CreateProperty]
[UxmlAttribute]
public float minDuration { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
resizable
Whether dragging an edge resizes the clip. Until assigned, it follows the variant: true for a Bar, false for the handle and surface variants, which draw no span to take hold of.
Declaration
[Tooltip("Whether dragging an edge resizes the clip.")]
[CreateProperty]
[UxmlAttribute]
public bool resizable { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
selected
Whether the clip draws its selected outline.
Declaration
[Tooltip("Whether the clip draws its selected outline.")]
[CreateProperty]
[UxmlAttribute]
public bool selected { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
start
The clip's start on the time axis, in time units.
Declaration
[Tooltip("The clip's start on the time axis, in time units.")]
[CreateProperty]
[UxmlAttribute]
public float start { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
variant
How the clip draws its span. Bar by default.
Declaration
[Tooltip("How the clip draws its span.")]
[CreateProperty]
[UxmlAttribute]
public TimelineClipVariant variant { get; set; }
Property Value
| Type | Description |
|---|---|
| TimelineClipVariant |
Remarks
For a track whose lane already shows the span, a bar would say it twice: Handle draws only a drag handle at the clip's start, and Surface draws nothing, so the lane itself is what you take hold of to move the clip.
Methods
GetFrameColorUssClassName(TimelineFrameColor)
Declaration
public static string GetFrameColorUssClassName(TimelineFrameColor enumValue)
Parameters
| Type | Name | Description |
|---|---|---|
| TimelineFrameColor | enumValue |
Returns
| Type | Description |
|---|---|
| string |
GetVariantUssClassName(TimelineClipVariant)
Declaration
public static string GetVariantUssClassName(TimelineClipVariant enumValue)
Parameters
| Type | Name | Description |
|---|---|---|
| TimelineClipVariant | enumValue |
Returns
| Type | Description |
|---|---|
| string |
OnAxisChanged()
Re-project this part onto the current axis.
Declaration
protected override void OnAxisChanged()
Overrides
Remarks
Called on attach and on every axis change — a scale, zoom, pan, playhead, tick or
selection change. Guard against a null axis.
Events
changed
Raised once on release with the committed start and duration.
Declaration
public event Action<float, float> changed
Event Type
| Type | Description |
|---|---|
| Action<float, float> |
clicked
Raised when the clip body is clicked without dragging.
Declaration
public event Action clicked
Event Type
| Type | Description |
|---|---|
| Action |
doubleClicked
Raised when the clip is double-clicked.
Declaration
public event Action doubleClicked
Event Type
| Type | Description |
|---|---|
| Action |
dragMove
Raised on every pointer move during a drag with the live start and duration.
Declaration
public event Action<float, float> dragMove
Event Type
| Type | Description |
|---|---|
| Action<float, float> |