-sd-animation: sd-fadeIn; –sd-duration: 250ms; –sd-easing: ease-in;
This article explains what the CSS-like custom properties in the title mean, how they work together, and practical ways to use them to create smooth, reusable fade-in animations in modern web UI components.
What these properties represent
- -sd-animation: a custom property (CSS variable) naming the animation to apply; here “sd-fadeIn” denotes a fade-in effect.
- –sd-duration: sets the animation duration; here 250ms.
- –sd-easing: sets the timing function; “ease-in” accelerates at the end for a subtle entrance.
These are likely part of a design system that exposes animation tokens as CSS variables so components can consistently reference and override animation behavior.
Example implementation
Define the animation keyframes and default tokens, then use them in components.
CSS:
:root {–sd-animation: sd-fadeIn; –sd-duration: 250ms; –sd-easing: ease-in; –sd-opacity-start: 0; –sd-opacity-end: 1; –sd-translate-y-start: 6px; –sd-translate-y-end: 0;}
@keyframes sd-fadeIn { from { opacity: var(–sd-opacity-start); transform: translateY(var(–sd-translate-y-start)); } to { opacity: var(–sd-opacity-end); transform: translateY(var(–sd-translate-y-end)); }}
/* Utility class to apply the system animation */.sd-animate { animation-name: var(–sd-animation); animation-duration: var(–sd-duration); animation-timing-function: var(–sd-easing); animation-fill-mode: both;}
HTML:
<div class=“sd-animate”>Hello — I fade in</div>
Customization patterns
- Override on a specific component:
.modal { –sd-duration: 400ms; –sd-easing: cubic-bezier(.2,.9,.2,1);}
- Respect reduced motion:
@media (prefers-reduced-motion: reduce) { .sd-animate { animation: none; opacity: 1; transform: none; }}
Use cases
- Micro-interactions: tooltips, toasts, and dropdown entrances.
- Progressive disclosure: reveal list items or cards.
- Theming: faster or slower animations for accessibility or brand feel.
Best practices
- Keep durations short (100–400ms) for responsiveness.
- Use easing that matches the motion intent (ease-out for exits, ease-in for entrances).
- Provide a reduced-motion fallback.
- Use CSS variables to centralize and tune motion across the app.
Conclusion
Using variables like -sd-animation: sd-fadeIn; –sd-duration: 250ms; –sd-easing: ease-in; makes animations consistent, customizable, and accessible across a design system — enabling developers to apply a single tokenized animation pattern to many components while allowing local overrides where needed.
Leave a Reply