”-sd-animation: sd-fadeIn; –sd-duration: 0ms; –sd-easing: ease-in;”
This title looks like a fragment of CSS custom properties and a shorthand for an animation declaration. Below is a concise article that explains what it means, when you might see it, and how to use and adjust it effectively.
What this snippet is
- –sd-animation: sd-fadeIn; — assigns a custom property named –sd-animation with the value “sd-fadeIn”, typically referencing a predefined animation keyframe set.
- –sd-duration: 0ms; — sets the animation duration to zero milliseconds, which effectively disables any visible animation because it completes instantly.
- –sd-easing: ease-in; — defines the timing function for the animation curve; “ease-in” accelerates from slow to fast at the start.
This pattern is often used in design systems or component libraries to provide configurable animation behavior via CSS variables.
Where you might encounter this
- Component libraries that allow per-component animation overrides
- Inline style injections (generated by frameworks or runtime theming systems)
- Progressive enhancement patterns where animations are toggled or parameterized
Why duration is set to 0ms
Setting duration to 0ms can be intentional:
- To disable the animation for a specific state (e.g., initial render or reduced-motion preferences).
- To ensure instant state changes while still keeping animation properties available for toggling later via scripting or CSS transitions.
- During testing or rendering snapshots when motion would interfere with consistent outputs.
However, if the goal is a visible fade-in, 0ms should be increased to a perceptible value (commonly 200–600ms).
How to make it into a working CSS example
Assuming a keyframes definition named sd-fadeIn, you can wire the variables into a real animation:
css
:root {–sd-animation: sd-fadeIn; –sd-duration: 300ms; /* change from 0ms to see motion / –sd-easing: ease-in;}
.fade-in { animation-name: var(–sd-animation); animation-duration: var(–sd-duration); animation-timing-function: var(–sd-easing); animation-fill-mode: both;}
/ Example keyframes */@keyframes sd-fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); }}
Practical tips
- Use 150–400ms for subtle UI fades; 400–600ms for more pronounced motion.
- Respect user preferences: disable non-essential animations when prefers-reduced-motion is set.
- Combine easing and duration to control perceived weight: slower easing (ease-out) feels softer; faster (ease-in) feels snappier.
- Keep variables names descriptive and consistent across a design system (e.g., –motion-fade-duration).
Accessibility note
Always consider prefers-reduced-motion:
css
@media (prefers-reduced-motion: reduce) { :root { –sd-duration:
Leave a Reply