These are CSS custom properties (variables) and a custom property-like declaration for an animation shorthand. Here’s what each part means and how to use them:
- –sd-animation: sd-fadeIn;
- What it is: a custom property storing the animation name (here “sd-fadeIn”).
- Use: reference it in the animation shorthand or animation-name to apply that animation.
- –sd-duration: 250ms;
- What it is: a custom property for the animation duration (250 milliseconds).
- Use: plug into animation-duration or the animation shorthand.
- –sd-easing: ease-in;
- What it is: a custom property for the timing function (easing).
- Use: reference it as animation-timing-function or in the animation shorthand.
Example usage (CSS):
css
:root {–sd-animation: sd-fadeIn; –sd-duration: 250ms; –sd-easing: ease-in;}
.my-element { animation-name: var(–sd-animation); animation-duration: var(–sd-duration); animation-timing-function: var(–sd-easing); animation-fill-mode: both;}
/* Keyframes for sd-fadeIn */@keyframes sd-fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); }}
Notes and tips:
- Using CSS variables lets you reuse and override animation settings easily (e.g., change duration on a parent).
- You can combine into the shorthand: animation: var(–sd-animation) var(–sd-duration) var(–sd-easing) both;
- Ensure the animation name matches the @keyframes rule.
Leave a Reply