Skip to content
awesome-tour

Type to search every page.

    BAnimationContents

    Animation

    Spring-animated overlays and content with @awesome-tour/motion, or plain CSS.

    Two ways to animate a tour:

    • CSS — parts stay mounted during exit animations, so keyframes on data-state work out of the box. See Styling.
    • @awesome-tour/motion — drop-in replacements built on Motion: a cutout that morphs between targets with springs, enter/exit presets, and in-place step transitions.
    @awesome-tour/motion
    Loopworknight-drive.lwp
    001.1.1
    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    Drums
    Beat A
    Beat B
    Bass
    Sub line
    Keys
    Rhodes
    Vox
    Hook (dry)

    Beat A

    16 steps · drums
    Kick
    Snare
    Hat
    Clap

    Mixer

    4 channels
    Drums
    80%
    Bass
    35%
    Keys
    60%
    Vox
    50%
    MotionDemo.tsx
    import { createTour, Tour } from '@awesome-tour/react';
    import { LoopworkApp, parts } from '@loopwork';
    import { useState } from 'react';
    import { TourMotionPopover } from '@/components/awesome-tour/tour-motion';
    import {
    Select,
    SelectContent,
    SelectItem,
    SelectTrigger,
    SelectValue,
    } from '@/components/ui/select';
    import { DemoFrame, StartButton } from './ui';
    const $ = parts('in-motion');
    const tour = createTour({
    id: 'docs-motion',
    steps: [
    {
    id: 'play',
    target: $('play'),
    title: 'Press play',
    description: 'Then go next and watch the spotlight ride the playhead.',
    },
    {
    id: 'playhead',
    target: $('playhead'),
    title: 'Springs follow',
    description: 'The cutout chases a moving target with a spring instead of jumping.',
    },
    {
    id: 'clips',
    target: [$('clip-c1'), $('clip-c3')],
    title: 'Shapes morph',
    description: 'Between steps the cutout morphs from one shape to the next.',
    },
    {
    id: 'reduced',
    target: $('mixer'),
    side: 'left',
    title: 'Reduced motion',
    description: 'With prefers-reduced-motion, every transition is instant.',
    },
    ],
    });
    const presets = ['slide', 'scale', 'fade', 'pop'] as const;
    type Preset = (typeof presets)[number];
    export function MotionDemo() {
    const [preset, setPreset] = useState<Preset>('slide');
    return (
    <Tour.Root tour={tour}>
    <DemoFrame
    title="@awesome-tour/motion"
    actions={
    <>
    <Select value={preset} onValueChange={(v) => setPreset(v as Preset)}>
    <SelectTrigger size="sm" aria-label="Animation preset" className="w-28">
    <SelectValue />
    </SelectTrigger>
    <SelectContent>
    {presets.map((p) => (
    <SelectItem key={p} value={p}>
    {p}
    </SelectItem>
    ))}
    </SelectContent>
    </Select>
    <StartButton />
    </>
    }
    >
    <LoopworkApp scope="in-motion" />
    </DemoFrame>
    <TourMotionPopover preset={preset} />
    </Tour.Root>
    );
    }
    Terminal window
    pnpm add @awesome-tour/motion motion
    import { MotionContent, MotionOverlay } from '@awesome-tour/motion';
    <Tour.Root tour={tour}>
    <Tour.Portal>
    <MotionOverlay padding={6} radius={10} />
    <MotionContent className="tour-card" preset="slide" animateStepChange>
    <Tour.Arrow />
    <Tour.Title />
    <Tour.Description />
    <Tour.Next>Next</Tour.Next>
    </MotionContent>
    </Tour.Portal>
    </Tour.Root>;

    Components

    Component Replaces What it adds
    MotionOverlay Tour.Overlay The cutout springs from target to target instead of jumping.
    MotionSpotlight Tour.Spotlight Same, for a styled spotlight element.
    MotionContent Tour.Content Enter/exit presets; animateStepChange animates between steps.

    Presets: fade, scale (default), slide (direction derived from the placed side) and pop. Or pass a factory that receives the side:

    <MotionContent
    preset={(side) => ({
    initial: { opacity: 0, y: side === 'top' ? 12 : -12 },
    animate: { opacity: 1, y: 0 },
    exit: { opacity: 0 },
    transition: { type: 'spring', bounce: 0.3, duration: 0.4 },
    })}
    />

    For custom renderers (canvas, WebGL), useSpotlightSprings() exposes the spring values of the highlighted rect.

    Reduced motion. When the user prefers reduced motion, movement is replaced by instant changes.

    Full API in the motion reference.