<MotionQueue />
Advanced animation sequencer for coordinating complex animation timelines across multiple elements.
Key Features
- Sequenced animation timelines
- 16 predefined delay calculation algorithms (linear/exponential/custom/sinusoidal/quantum/etc.)
- Dynamic queue regeneration
- Type-safe animation coordination
- Automatic child-animation matching
- Nested animation support
Basic Usage
import MotionQueue from "@/components/MotionProvider/motion-queue";
import { FC } from "react";
export const Experiment: FC = () => {
return (
<MotionQueue
elementType="div"
duration={1}
isDynamicallyQueued
animations={[
{
mode: ["filterBlurIn", "fadeRight"],
duration: 1,
transition: "smooth",
},
]}
>
<h2 className="pt-12 lg:text-3xl font-bold">
Hello World
</h2>
</MotionQueue>
);
}
Delay Logic Types
//use predefined delay logic inside MotionQueue as follows
isDynamicallyQueued + delayLogic: "linear" | "exponential" | "sinusoidal"
//or create custom delay logic inside MotionQueue as follows (assuming you have an index variable)
isDynamicallyQueued + customDelayLogic = (index: number) => {
return index * 0.5
//or use fixed delay logic with this
delayByElement: 1
Custom delay functions receive the element index and base duration
Component Props
Prop | Type | Default | Description |
---|---|---|---|
animations | AnimationQueueAnimationProps[] | required | Array of animation configs for each child |
children | React.ReactNode[] | required | Array of elements to animate |
delayLogic | 'linear' | 'exponential' | 'sinusoidal' | 'custom' | 'linear' | Algorithm for calculating staggered delays |
duration | number | 0.5 | Base duration for delay calculations (seconds) |
isDynamicallyQueued | boolean | false | Enable dynamic delay calculation |
delayByElement | number | - | Fixed delay per element (overrides logic) |
customLogic | (index: number) => number | - | Custom delay calculation function |
Best Practices
Do's
- Match animation and children array lengths
- Use dynamic queuing for variable-length content
- Combine with <MotionContainer />
Don'ts
- Don't use with infinite animations
- Avoid mixing controlled/uncontrolled children
- Don't overload with 50+ simultaneous animations
- Avoid complex custom logic in render