Class AnimationCurveField
A field that previews an AnimationCurve and opens a curve editor when pressed.
Inheritance
Implements
Inherited Members
Namespace: Unity.AppUI.UI
Assembly: Unity.AppUI.dll
Syntax
[UxmlElement]
public class AnimationCurveField : ExVisualElement, IEventHandler, IResolvedStyle, ITransform, ITransitionAnimations, IExperimentalFeatures, IVisualElementScheduler, IContextOverrideElement, IAdditionalDataHolder, IInputElement<AnimationCurve>, IValidatableElement<AnimationCurve>, INotifyValueChanging<AnimationCurve>, INotifyValueChanged<AnimationCurve>, ISizeableElement, IPressable
Remarks
The thumbnail is stroked with Painter2D straight into the element's mesh, so it needs neither a shader nor a render texture — unlike ColorSwatch and CanvasBackground, whose fills genuinely require one.
The horizontal axis spans the curve's own time range and the vertical axis spans
[0, 1], widened to the curve's value range when the curve leaves that band, so a
curve is never silently drawn clipped flat against an edge.
Like ColorField, the field and its editor are separable: the editor arrives through customPicker. With no picker assigned the control is still a useful, correct curve display — which is why it ships ahead of the editor.
The stroke color comes from the --curve-color custom property, which
AnimationCurveField.uss binds to --appui-alias-semantic-positive.
Example
var field = new AnimationCurveField { value = AnimationCurve.EaseInOut(0f, 0f, 1f, 1f) };
UXML
<appui:AnimationCurveField size="Md" />
Constructors
AnimationCurveField()
Default constructor.
Declaration
public AnimationCurveField()
Fields
previewUssClassName
The AnimationCurveField preview styling class.
Declaration
public const string previewUssClassName = "appui-animationcurvefield__preview"
Field Value
| Type | Description |
|---|---|
| string |
sizeUssClassName
The AnimationCurveField size styling class.
Declaration
public const string sizeUssClassName = "appui-animationcurvefield--size-"
Field Value
| Type | Description |
|---|---|
| string |
ussClassName
The AnimationCurveField main styling class.
Declaration
public const string ussClassName = "appui-animationcurvefield"
Field Value
| Type | Description |
|---|---|
| string |
Properties
clickable
Clickable Manipulator for this AnimationCurveField.
Declaration
[CreateProperty]
public Pressable clickable { get; set; }
Property Value
| Type | Description |
|---|---|
| Pressable |
contentContainer
The content container of this element.
Declaration
public override VisualElement contentContainer { get; }
Property Value
| Type | Description |
|---|---|
| VisualElement |
Overrides
customPicker
The editor opened when the field is pressed. Null by default.
Declaration
[CreateProperty]
public ICustomAnimationCurveFieldPicker customPicker { get; set; }
Property Value
| Type | Description |
|---|---|
| ICustomAnimationCurveFieldPicker |
invalid
Whether the current value is valid, as determined by validateValue.
Declaration
[CreateProperty]
[UxmlAttribute]
public bool invalid { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
previewElement
The element the curve is stroked into.
Declaration
public VisualElement previewElement { get; }
Property Value
| Type | Description |
|---|---|
| VisualElement |
size
The size of the element.
Declaration
[CreateProperty]
[UxmlAttribute]
public Size size { get; set; }
Property Value
| Type | Description |
|---|---|
| Size |
validateValue
A function that validates the value of the AnimationCurveField.
Declaration
[CreateProperty]
public Func<AnimationCurve, bool> validateValue { get; set; }
Property Value
| Type | Description |
|---|---|
| Func<AnimationCurve, bool> |
value
The current value of the AnimationCurveField.
Declaration
[CreateProperty]
public AnimationCurve value { get; set; }
Property Value
| Type | Description |
|---|---|
| AnimationCurve |
Methods
GetSizeUssClassName(Size)
Declaration
public static string GetSizeUssClassName(Size enumValue)
Parameters
| Type | Name | Description |
|---|---|---|
| Size | enumValue |
Returns
| Type | Description |
|---|---|
| string |
OpenPicker()
Opens customPicker, as pressing the field does.
Declaration
public void OpenPicker()
SetValueWithoutNotify(AnimationCurve)
Sets the value without sending a change event.
Declaration
public void SetValueWithoutNotify(AnimationCurve newValue)
Parameters
| Type | Name | Description |
|---|---|---|
| AnimationCurve | newValue | The new curve. |
Events
pickRequested
Raised when the user asks for the editor, whether or not a customPicker is assigned.
Declaration
public event Action pickRequested
Event Type
| Type | Description |
|---|---|
| Action |