@carbon/motion supports standard, entrance, and exit easing curves in two
motion modes: productive and expressive. It also provides duration tokens and
named motion surfaces. You can access these using either Sass or JavaScript.
Build note: Token values are generated at build time from
src/dtcg/motion.json and src/dtcg/surfaces.json. Run yarn build (or
npm run build) once after cloning so that js/generated/ and
scss/generated/ are present.
@carbon/motion exports a motion function and motion mixin for easing
curves, duration token variables, a surface function and surface mixin for
named motion surfaces. Bring in the package with @use:
@use'@carbon/motion';
.my-selector {
// Easing curve — productive mode by defaulttransition-timing-function: motion.motion(standard);
}
.my-selector-expressive {
// Easing curve with explicit mode, set as transition-timing-function@include motion.motion(standard, expressive);
}
.my-panel {
// Apply a named motion surface (handles enter/exit keyframes and timing)@include motion.surface(contextual);
}
We're always looking for contributors to help us fix bugs, build new features,
or help us improve the project documentation. If you're interested, definitely
check out our Contributing Guide!
This package uses IBM Telemetry to collect de-identified and anonymized metrics
data. By installing this package as a dependency you are agreeing to telemetry
collection. To opt out, see
Opting out of IBM Telemetry data collection.
For more information on the data being collected, please see the
IBM Telemetry documentation.