Utilities
Transition Timing Function
The Transition Timing Function
utility provides control over the rate of speed at which a transition effect progresses. This utility allows for the creation of more dynamic and engaging animations by adjusting the speed curve of the transition.
Utility Class | USS Properties |
---|---|
ease-linear | transition-timing-function: linear; |
ease-in | transition-timing-function: ease-in; |
ease-out | transition-timing-function: ease-out; |
ease-in-out | transition-timing-function: ease-in-out; |
ease-in-sine | transition-timing-function: ease-in-sine; |
ease-out-sine | transition-timing-function: ease-out-sine; |
ease-in-out-sine | transition-timing-function: ease-in-out-sine; |
ease-in-cubic | transition-timing-function: ease-in-cubic; |
ease-out-cubic | transition-timing-function: ease-out-cubic; |
ease-in-out-cubic | transition-timing-function: ease-in-out-cubic; |
ease-in-circ | transition-timing-function: ease-in-circ; |
ease-out-circ | transition-timing-function: ease-out-circ; |
ease-in-out-circ | transition-timing-function: ease-in-out-circ; |
ease-in-elastic | transition-timing-function: ease-in-elastic; |
ease-out-elastic | transition-timing-function: ease-out-elastic; |
ease-in-out-elastic | transition-timing-function: ease-in-out-elastic; |
ease-in-back | transition-timing-function: ease-in-back; |
ease-out-back | transition-timing-function: ease-out-back; |
ease-in-out-back | transition-timing-function: ease-in-out-back; |
ease-in-bounce | transition-timing-function: ease-in-bounce; |
ease-out-bounce | transition-timing-function: ease-out-bounce; |
ease-in-out-bounce | transition-timing-function: ease-in-out-bounce; |
Basic Usage in UXML
To customize the transition timing, use one of the ease-{type}
classes. Each {type}
represents a different timing function, allowing for precise control over the animation's behavior. Combine this utility with other transition utilities like Transition Duration and Transition Delay for comprehensive control over animations.
<ui:VisualElement class="ease-out-cubic transition-colors bg-red-500 hover:bg-blue-500">
<!-- Element with a cubic easing-out transition for color changes -->
</ui:VisualElement>
Customize
Modifier Variations
You can customize which modifier variations of the Transition Timing Function
utility are generated, such as pseudo-classes (e.g., hover
, focus
) and custom modifiers.
Transition Timing Function
utility.By fine-tuning the utility variations, you maintain control over your stylesheet's size and complexity, ensuring that only necessary styles are included. To update these values:
- Open the Theme Config Asset: Find the asset within your Unity project.
- Navigate to the 'Utilities' Section: Locate the
Transition Timing Function
utility. - Adjust Modifier Variations: Select which modifiers you want to be generated for the utility. Keep in mind that the order of the modifiers will affect the order and specificity of the generated USS classes.
Class Tags and Properties
The Transition Timing Function
utility generates classes based on predefined tags and their associated USS properties. While we recommend keeping these defaults for consistency and ease of reference in our documentation, you have the option to customize them to suit your project's specific needs.
These values are prepended to the defined values in this format tag-{value}
. If a tag is empty, the generated class will simply be the value by itself.
Here are the default tags and the USS properties they set for the Transition Timing Function
utility:
- ease : transition-timing-function
To customize these tags and properties, you can edit the Tag Property Map
field for the Transition Timing Function
utility in the Theme Config asset. This allows you to define new tags or modify existing ones, thus tailoring the generated classes to your preferences.
Extending Core Fields
The Transition Timing Function
utility does not extend any fields from the Core
section of the Theme Config asset. Before you try to extend any fields, we recommend checking Unity's documentation to verify which types of values are expected by the relevant USS properties.
To customize or define these extended fields:
- Open the Theme Config Asset: Locate the asset within your Unity project.
- Navigate to the 'Utilities' Section: Find the
Transition Timing Function
utility. - Customize Extend Fields: Modify or add fields in the
Extend Fields
array to change the core configuration values that are extended. You'll only be able to extend fields of the same type.
Disable Utility
The Transition Timing Function
utility is enabled by default. You can disable it by unchecking the Enabled
option in the Theme Config asset. This will prevent the generation of the utility's styles.