-sd-animation: sd-fadeIn; –sd-duration: 0ms; –sd-easing: ease-in;
The CSS fragment ”-sd-animation: sd-fadeIn; –sd-duration: 0ms; –sd-easing: ease-in;” looks like a set of custom properties and a vendor-like shorthand used by a design system. Below is a concise explanation, usage examples, and guidance for making it practical.
What it is
- -sd-animation: a custom shorthand property (likely from a design system) that names a predefined animation (here,
sd-fadeIn). - –sd-duration: a CSS custom property controlling animation duration; set to
0ms(instant). - –sd-easing: a CSS custom property for easing/timing function;
ease-inhere.
Together they indicate an element should use the sd-fadeIn animation but with zero duration and an ease-in curve — effectively no visible transition.
Practical intent
- Likely used to toggle animation behavior via variables without changing core animation definitions.
- Setting
–sd-duration: 0msis useful for disabling animations (e.g., for accessibility or initial render), while other contexts can override it to enable transitions.
Example CSS usage
css
:root {–sd-duration: 200ms; –sd-easing: ease-out;}
/* Design-system animation definition /@keyframes sd-fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); }}
/ Utility that applies the animation using variables */.sd-animate { animation-name: sd-fadeIn; animation-duration: var(–sd-duration, 200ms); animation-timing-function: var(–sd-easing, ease-out); animation-fill-mode: both;}
Overriding to disable animation
html
<div class=“sd-animate” style=”–sd-duration: 0ms; –sd-easing: ease-in;”> Instantly shown (no visible fade)</div>
Accessibility notes
- Respect user motion preferences: prefer
prefers-reduced-motionto set–sd-duration: 0msautomatically.
css
@media (prefers-reduced-motion: reduce) { :root { –sd-duration: 0ms; }}
Recommendations
- Use meaningful default durations (e.g., 150–300ms) and permit overrides via custom properties.
- Keep easing consistent across the design system (e.g., ease-out for entrances).
- Provide utilities for turning animations off globally for testing and accessibility.
If you want, I can convert this into a short tutorial, a copy-ready component, or variants (e.g., slide-in, scale) using the same variable approach.
Leave a Reply