com um clique
slidev-transitions
// Add smooth slide transitions in Slidev. Use this skill for fade, slide, and custom transitions between slides.
// Add smooth slide transitions in Slidev. Use this skill for fade, slide, and custom transitions between slides.
Master v-click and sequential animations in Slidev. Use this skill to reveal content progressively and create engaging presentations.
Create beautiful code blocks with Shiki syntax highlighting. Use this skill for code snippets, line highlighting, and code groups.
Animate code transformations with Shiki Magic Move. Use this skill to create smooth morphing transitions between code states.
Add live coding with Monaco Editor in Slidev. Use this skill for interactive code demos, executable code, and real-time editing.
Leverage Vue components in Slidev slides. Use this skill to add interactivity with built-in components or create custom ones.
Use built-in and custom Slidev layouts effectively. Use this skill to structure slides with cover, two-cols, image layouts and more.
| name | slidev-transitions |
| description | Add smooth slide transitions in Slidev. Use this skill for fade, slide, and custom transitions between slides. |
This skill covers adding smooth transitions between slides in Slidev, including built-in transitions, custom animations, and directional transitions.
---
transition: slide-left
---
Applied to all slides in the presentation.
---
transition: fade
---
# This slide fades in
---
transition: slide-up
---
# This slide slides up
# Slide 1
---
transition: zoom
---
# Slide 2 (zooms in)
| Name | Effect |
|---|---|
fade | Simple fade in/out |
fade-out | Fade out, then appear |
---
transition: fade
---
| Name | Effect |
|---|---|
slide-left | New slide enters from right |
slide-right | New slide enters from left |
slide-up | New slide enters from bottom |
slide-down | New slide enters from top |
---
transition: slide-left
---
Uses the modern View Transitions API:
---
transition: view-transition
---
Note: Requires browser support for View Transitions API.
Use | to separate forward and backward transitions:
---
transition: slide-left | slide-right
---
# Natural slide direction
---
transition: slide-left | slide-right
---
# Vertical navigation
---
transition: slide-up | slide-down
---
# Fade forward, slide back
---
transition: fade | slide-right
---
Create styles/index.css:
/* Define custom transition */
.my-transition-enter-active,
.my-transition-leave-active {
transition: all 0.5s ease;
}
.my-transition-enter-from {
opacity: 0;
transform: translateX(100px) rotate(10deg);
}
.my-transition-leave-to {
opacity: 0;
transform: translateX(-100px) rotate(-10deg);
}
Use in frontmatter:
---
transition: my-transition
---
Slidev uses Vue transition classes:
| Class | When Applied |
|---|---|
[name]-enter-from | Starting state for enter |
[name]-enter-active | During enter transition |
[name]-enter-to | Ending state for enter |
[name]-leave-from | Starting state for leave |
[name]-leave-active | During leave transition |
[name]-leave-to | Ending state for leave |
.scale-enter-active,
.scale-leave-active {
transition: all 0.4s ease;
}
.scale-enter-from {
opacity: 0;
transform: scale(0.8);
}
.scale-leave-to {
opacity: 0;
transform: scale(1.2);
}
.flip-enter-active,
.flip-leave-active {
transition: all 0.6s ease;
transform-style: preserve-3d;
}
.flip-enter-from {
opacity: 0;
transform: rotateY(-90deg);
}
.flip-leave-to {
opacity: 0;
transform: rotateY(90deg);
}
.blur-enter-active,
.blur-leave-active {
transition: all 0.5s ease;
}
.blur-enter-from {
opacity: 0;
filter: blur(20px);
}
.blur-leave-to {
opacity: 0;
filter: blur(20px);
}
.bounce-enter-active {
animation: bounce-in 0.5s;
}
.bounce-leave-active {
animation: bounce-out 0.5s;
}
@keyframes bounce-in {
0% {
opacity: 0;
transform: scale(0.3);
}
50% {
transform: scale(1.1);
}
100% {
opacity: 1;
transform: scale(1);
}
}
@keyframes bounce-out {
0% {
opacity: 1;
transform: scale(1);
}
100% {
opacity: 0;
transform: scale(0.3);
}
}
.swipe-enter-active,
.swipe-leave-active {
transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.swipe-enter-from {
opacity: 0;
transform: translateX(100%);
}
.swipe-leave-to {
opacity: 0;
transform: translateX(-100%);
}
---
transition: view-transition
---
<div style="view-transition-name: hero">
Content that transitions smoothly
</div>
Elements with the same view-transition-name on consecutive slides will animate between their positions.
---
transition: view-transition
---
<div style="view-transition-name: card" class="w-32 h-32 bg-blue-500">
Small card
</div>
---
transition: view-transition
---
<div style="view-transition-name: card" class="w-64 h-64 bg-blue-500">
Card grows!
</div>
.slow-fade-enter-active,
.slow-fade-leave-active {
transition: all 1s ease; /* 1 second */
}
/* Common easing functions */
.ease-in { transition-timing-function: ease-in; }
.ease-out { transition-timing-function: ease-out; }
.ease-in-out { transition-timing-function: ease-in-out; }
.linear { transition-timing-function: linear; }
/* Cubic bezier for custom easing */
.custom { transition-timing-function: cubic-bezier(0.68, -0.55, 0.265, 1.55); }
.delayed-enter-active {
transition: all 0.5s ease 0.2s; /* 0.2s delay */
}
---
layout: cover
transition: fade
---
# Title Slide
---
layout: default
transition: slide-left
---
# Content Slide
---
layout: section
transition: zoom
---
# Section Break
---
layout: end
transition: fade
---
# Thank You
---
transition: none
---
---
transition: false
---
Use the same transition family throughout:
# Good: Consistent slide family
---
transition: slide-left | slide-right
---
| Content | Suggested Transition |
|---|---|
| Cover/Title | fade |
| Regular content | slide-left |
| Section break | fade or zoom |
| Demo/Code | fade |
| Conclusion | fade |
❌ Too flashy
.crazy-enter-active {
animation: spin 2s, bounce 1s, flash 0.5s;
}
✓ Professional
.subtle-enter-active {
transition: opacity 0.3s ease;
}
Complex transitions may lag on:
/* styles/transitions.css */
/* Gentle fade */
.pro-fade-enter-active,
.pro-fade-leave-active {
transition: opacity 0.3s ease;
}
.pro-fade-enter-from,
.pro-fade-leave-to {
opacity: 0;
}
/* Smooth slide */
.pro-slide-enter-active,
.pro-slide-leave-active {
transition: all 0.35s ease-out;
}
.pro-slide-enter-from {
opacity: 0;
transform: translateX(30px);
}
.pro-slide-leave-to {
opacity: 0;
transform: translateX(-30px);
}
/* Energetic bounce */
.playful-enter-active {
animation: pop-in 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}
@keyframes pop-in {
0% { transform: scale(0); opacity: 0; }
80% { transform: scale(1.1); }
100% { transform: scale(1); opacity: 1; }
}
When configuring transitions:
---
# GLOBAL TRANSITION (first slide)
transition: [transition-name] | [backward-transition]
---
# Slide content...
---
# PER-SLIDE OVERRIDE (if needed)
transition: [different-transition]
---
# Different slide content...
TRANSITION PLAN:
CUSTOM CSS (if needed):
.[name]-enter-active { ... }
.[name]-leave-to { ... }