These are CSS custom properties (variables) used to control a component animation. Breakdown:
- -sd-animation: sd-fadeIn;
- Purpose: names the animation to apply (here, a fade-in preset called “sd-fadeIn”). The actual keyframes must be defined elsewhere (e.g., @keyframes sd-fadeIn).
- –sd-duration: 250ms;
- Purpose: animation duration — how long one run takes (250 milliseconds).
- –sd-easing: ease-in;
- Purpose: timing function — controls acceleration of the animation (starts slowly, speeds up).
How they’re typically used:
- Defined on an element (or :root) as custom properties:
- –sd-animation: sd-fadeIn;
- –sd-duration: 250ms;
- –sd-easing: ease-in;
- Then referenced in animation-related CSS:
- animation-name: var(–sd-animation);
- animation-duration: var(–sd-duration);
- animation-timing-function: var(–sd-easing);
- animation-fill-mode / iteration-count can also be set.
Example:
css
.element {–sd-animation: sd-fadeIn; –sd-duration: 250ms; –sd-easing: ease-in;
animation-name: var(–sd-animation); animation-duration: var(–sd-duration); animation-timing-function: var(–sd-easing); animation-fill-mode: both;}
@keyframes sd-fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); }}
Notes:
- Names starting with a single dash (e.g., -sd-animation) are allowed but nonstandard convention; standard custom properties must start with two dashes (–) to be used with var(). Using -sd-animation won’t work with var() unless you reference it exactly; better use –sd-animation.
- Ensure keyframes exist for the animation-name value.
- You can override these properties per element to control timing/easing centrally.
Leave a Reply