On this Page
MotionTransition
MotionTransition is the timing and spring configuration accepted by Fractalsvelte motion primitives. It is a TypeScript type that selects the supported transition fields from Motion’s AnimationOptions.
Usage
Svelte
<script lang="ts">
import { Motion, type MotionTransition } from 'fractalsvelte/motion';
const reveal: MotionTransition = {
duration: 0.2,
ease: 'easeOut',
delay: 0.08
};
</script>
<Motion
initial={{ opacity: 0, y: 8 }}
animate={{ opacity: 1, y: 0 }}
transition={reveal}
>
Content
</Motion>
Use a spring when the physical response matters more than a fixed duration:
TypeScript
import { type MotionTransition } from "fractalsvelte/motion";
const spring: MotionTransition = {
type: "spring",
stiffness: 280,
damping: 28,
bounce: 0,
};
API
TypeScript
type MotionTransition = Pick<
AnimationOptions,
"duration" | "ease" | "delay" | "type" | "stiffness" | "damping" | "bounce"
>;
| Field | Type | Description |
|---|---|---|
duration | number | Duration in seconds for duration-based animation. |
ease | AnimationOptions['ease'] | Easing name, cubic-bezier tuple, or easing definition supported by Motion. |
delay | number | Delay in seconds before the animation begins. |
type | AnimationOptions['type'] | Animation type, including 'spring' when spring configuration is required. |
stiffness | number | Spring stiffness. Used with spring transitions. |
damping | number | Spring damping. Used with spring transitions. |
bounce | number | Spring bounciness. Used with spring transitions. |
Related APIs
- Use
transitionsandmotionIntentsfor the package’s semantic defaults. - Use
MotionPresetto define the keyframes that this type times. Motion,Layout,Drag,SharedLayout,ReorderGroup, andMotionProviderall accept aMotionTransitionthrough theirtransitionprop.
