Motion plays a key role in creating a smooth and engaging user experience. Our design system provides standardised functions for animation duration and easing curves to ensure consistency across all components.
ds-duration
The ds-duration function allows you to fetch a standard animation duration from the design system. Using these predefined durations ensures that your animations are consistent with the overall design language.
Available options:
- short-1: 100ms
- short-2: 150ms
- medium-1: 200ms
- medium-2: 350ms
- long-1: 500ms
- long-2: 700ms
Example usage:
/* Component with a short animation duration */
.c-animated-component {
animation-duration: ds-duration("short-1");
}
Application guidelines:
- Short durations (short-1 and short-2) are ideal for quick transitions, such as button presses or small UI elements moving.
- Medium durations (medium-1 and medium-2) work well for slightly longer transitions, like modals appearing or sliding content.
- Long durations (long-1 and long-2) are suitable for significant changes in the UI, such as page transitions or large elements moving.
ds-easing
The ds-easing function fetches a standard easing curve from the design system. Easing curves control the acceleration and deceleration of animations, creating a more natural and visually pleasing movement.
Available options:
- standard: cubic-bezier(0.3, 0, 0.1, 1.0) - A balanced easing curve suitable for most animations.
- enter: cubic-bezier(0, 0.2, 0.1, 1.0) - A curve designed for entering elements, with a slightly slower start and faster end.
- exit: cubic-bezier(0.3, 0, 0.8, 0.15) - A curve tailored for exiting elements, with a quick start and a slow finish.
Example usage:
/* Component with a standard easing for animations */
.c-animated-component {
animation-timing-function: ds-easing("standard");
}
Application guidelines:
- Standard easing is versatile and should be used for most animations to ensure a consistent feel.
- Enter easing is ideal for elements that need to draw attention as they appear, making the entry feel deliberate and noticeable.
- Exit easing is useful when an element leaves the screen, providing a quick start to signify the departure, followed by a gentle slowdown.
Combining duration and easing
To create smooth and cohesive animations, combine ds-duration and ds-easing values. This ensures that the timing and motion of your components are aligned with the design system’s standards.
Example usage:
.c-animated-component {
animation-duration: ds-duration("medium-1");
animation-timing-function: ds-easing("enter");
}
This example sets a medium-duration animation with an easing curve that is designed for elements entering the view, providing a smooth and engaging user experience.