Skip to content

Commit c1c43f9

Browse files
committed
feat: element transitions
1 parent b1f6478 commit c1c43f9

File tree

2 files changed

+55
-2
lines changed

2 files changed

+55
-2
lines changed

guide/animations.md

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,53 @@ clicks: 3
9191
</v-clicks>
9292
```
9393

94-
## Transitions
94+
## Element Transitions
9595

96-
The built-in support for slides and elements transitions is NOT YET provided in the current version. We are planning to add support for them in the next major version. Before that, you can still use your custom styles and libraries to do that.
96+
When you apply the `v-click` directive to your elements, it will attach the class name `slidev-vclick-target` to it. When the elements are hidden, the class name `slidev-vclick-hidden` will also be attached. For example:
97+
98+
```html
99+
<div class="slidev-vclick-target slidev-vclick-hidden">Text</div>
100+
```
101+
102+
After a click, it will become
103+
104+
```html
105+
<div class="slidev-vclick-target">Text</div>
106+
```
107+
108+
By default, a subtle opacity transition is applied to those classes:
109+
110+
```css
111+
// the default
112+
113+
.slidev-vclick-target {
114+
transition: opacity 100ms ease;
115+
}
116+
117+
.slidev-vclick-hidden {
118+
opacity: 0;
119+
pointer-events: none;
120+
}
121+
```
122+
123+
You can override them to customize the transition effects in your custom stylesheets.
124+
125+
For example, you can achieve the scale up transitions by:
126+
127+
```css
128+
// styles.css
129+
130+
.slidev-vclick-target {
131+
transition: all 500ms ease;
132+
}
133+
134+
.slidev-vclick-hidden {
135+
transform: scale(0);
136+
}
137+
```
138+
139+
Learn more about [customizing styles](/custom/directory-structure#style).
140+
141+
## Pages Transitions
142+
143+
The built-in support for slides is NOT YET provided in the current version. We are planning to add support for them in the next major version. Before that, you can still use your custom styles and libraries to do that.

guide/syntax.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ console.log('Hello, World!')
7272
//```
7373
~~~
7474

75+
### Line Highlighting
76+
7577
To highlight specific lines, simply add line numbers within bracket `{}`. Line numbers start counting from 1.
7678

7779
~~~ts
@@ -100,6 +102,8 @@ function add(
100102

101103
This will first highlight `a: Ref<number> | number` and `b: Ref<number> | number`, and then `return computed(() => unref(a) + unref(b))` after one click, and lastly, the whole block. Learn more in the [clicks animations guide](/guide/animations).
102104

105+
### Monaco Editor
106+
103107
Whenever you want to do some modification in the presentation, simply add `{monaco}` after the language id — it turns the block into a fully-featured Monaco editor!
104108

105109
~~~ts
@@ -108,6 +112,8 @@ console.log('HelloWorld')
108112
//```
109113
~~~
110114

115+
Learn more about [configuring Monaco](/custom/config-monaco).
116+
111117
## Notes
112118

113119
You can also take notes for each slide. They will show up in [Presenter Mode](/guide/presenter-mode) for you to reference during presentations.

0 commit comments

Comments
 (0)