--- name: animations description: Click animations, motion effects, and slide transitions --- # Animations Click animations, motion effects, and slide transitions. ## Click Animations ### v-click Directive ```md
Appears on click
Appears on next click
``` ### v-clicks Component Animate list items: ```md - Item 1 - Item 2 - Item 3 ``` With depth for nested lists: ```md - Parent 1 - Child 1 - Child 2 - Parent 2 ``` ### Click Positioning Relative positioning: ```md
1st (default)
2nd
Same as previous
``` Absolute positioning: ```md
Appears on click 3
Visible clicks 2-5
``` ### v-after Show with previous element: ```md
Main element
Appears with main element
``` ### v-switch Conditional rendering by click: ```md ``` ## Custom Click Count ```md --- clicks: 10 --- ``` Or starting from specific count: ```md --- clicksStart: 5 --- ``` ## Motion Animations Using @vueuse/motion: ```md
Animated content
``` Click-based motion: ```md
Scales on clicks
``` ## Slide Transitions In headmatter (all slides): ```md --- transition: slide-left --- ``` Per-slide: ```md --- transition: fade --- ``` ### Built-in Transitions - `fade` / `fade-out` - `slide-left` / `slide-right` - `slide-up` / `slide-down` - `view-transition` (View Transitions API) ### Directional Transitions Different transitions for forward/backward: ```md --- transition: slide-left | slide-right --- ``` ### Custom Transitions Define CSS classes: ```css .my-transition-enter-active, .my-transition-leave-active { transition: all 0.5s ease; } .my-transition-enter-from, .my-transition-leave-to { opacity: 0; transform: translateX(100px); } ``` Use: `transition: my-transition` ## CSS Classes Animation targets get these classes: - `.slidev-vclick-target` - Animated element - `.slidev-vclick-hidden` - Hidden state - `.slidev-vclick-current` - Current click target - `.slidev-vclick-prior` - Previously shown ## Default Animation CSS ```css .slidev-vclick-target { transition: opacity 100ms ease; } .slidev-vclick-hidden { opacity: 0; pointer-events: none; } ```