Utilities
Transition Delay
The Transition Delay
utility allows you to specify the duration to wait before starting a property's transition effect upon its value change. This utility provides control over the timing of transitions, enhancing the interactive experience by allowing for precise delay adjustments.
Utility Class | USS Properties |
---|---|
transition-delay-0 | transition-delay: 0s; |
transition-delay-75 | transition-delay: 75ms; |
transition-delay-100 | transition-delay: 100ms; |
transition-delay-150 | transition-delay: 150ms; |
transition-delay-200 | transition-delay: 200ms; |
transition-delay-300 | transition-delay: 300ms; |
transition-delay-500 | transition-delay: 500ms; |
transition-delay-700 | transition-delay: 700ms; |
transition-delay-1000 | transition-delay: 1000ms; |
Basic Usage in UXML
To apply a transition delay, use one of the transition-delay-{value}
classes, where {value}
indicates the delay duration in milliseconds or seconds. Note that the transition-delay
classes should be used in conjunction with the Transition Property
utility to specify the properties to transition.
<ui:Button class="transition-delay-150 transition bg-red-500 hover_bg-pink-400">
<!-- Button with a 150ms transition delay between the bg-red-500 and hover_bg-pink-400 transition -->
</ui:Button>
Adding Transition Delays
You can customize transition delays to suit your UI design needs. Use the Theme Config asset to define custom delay values and apply them using the generated utility classes.
Customize
Modifier Variations
You can customize which modifier variations of the Transition Delay
utility are generated, such as pseudo-classes (e.g., hover
, focus
) and custom modifiers.
Transition Delay
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 Delay
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 Delay
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 Delay
utility:
- transition-delay : transition-delay
To customize these tags and properties, you can edit the Tag Property Map
field for the Transition Delay
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 Delay
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 Delay
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 Delay
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.