These are CSS custom properties (CSS variables) and a shorthand-like declaration used to control a component’s animation. Breakdown:
- –sd-animation: sd-fadeIn;
- Defines which animation to apply. “sd-fadeIn” is likely a keyframe animation name or a token that a component’s stylesheet maps to a keyframes rule.
- –sd-duration: 250ms;
- Duration of the animation (250 milliseconds).
- –sd-easing: ease-in;
- Timing function controlling acceleration of the animation.
How they’re typically used
- In a component stylesheet you’d read these variables and apply them to animation-related properties, for example:
animation-name: var(–sd-animation, none);animation-duration: var(–sd-duration, 200ms);animation-timing-function: var(–sd-easing, ease);animation-fill-mode: both;
- Or components may map custom tokens (like sd-fadeIn) to actual keyframes:
@keyframes sd-fadeIn {from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); }}
Notes and tips
- Provide fallback values in var(…) to avoid unexpected behavior if a variable is missing.
- Combine with prefers-reduced-motion media query to respect user motion preferences:
@media (prefers-reduced-motion: reduce) { .animated { animation: none !important; }}
- You can also animate via transition if only toggling simple properties (opacity, transform), but keyframe animation allows more complex sequences.
If you want, I can:
- Show a complete example component using these variables.
Leave a Reply