1.0.0 • Published 1 week ago
@primeuix/motion
Licence
SEE LICENSE IN LICENSE.md
Version
1.0.0
Deps
1
Size
21 kB
Vulns
0
Weekly
0
Stars
93
PrimeUIX Motion
Framework-agnostic motion engine for CSS transitions and animations. Drives enter/leave phase logic, manages lifecycle hooks, tracks element dimensions for height/width expand-collapse effects, and respects prefers-reduced-motion.
import { createMotion } from '@primeuix/motion';
const motion = createMotion(el, {
name: 'p-overlay',
autoHeight: true,
onBeforeEnter: (el) => { ... },
onAfterLeave: (el) => { ... }
});
motion.enter();
motion.leave();
Phases are driven through data-enter-phase / data-leave-phase attributes on the target element, which CSS classes hook into. Height and width transitions read dimensions via scrollHeight / scrollWidth and expose them as CSS custom properties. When safe is set, motion is skipped entirely if the user has requested reduced motion.
License
Licensed under the PrimeUI License - Copyright (c) PrimeTek Informatics