You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
By default, these animations have the [default CSS animations for View Transitions](https://developer.mozilla.org/en-US/docs/Web/API/View_Transition_API/Using#customizing_your_animations) applied (most are given a default smooth cross-fade). You can use [view transition psuedo-selectors](https://developer.mozilla.org/en-US/docs/Web/API/View_Transition_API/Using#the_view_transition_pseudo-element_tree) to define "how" the animation runs. For example, using `*` we can change the default for all animations:
94
94
95
95
```
96
-
// ✅ "how" to animate.
96
+
// "how" to animate.
97
97
::view-transition-old(*) {
98
98
animation: 300ms ease-out fade-out;
99
99
}
@@ -1280,7 +1280,7 @@ In our example app above, notice that there are already animations when you clic
1280
1280
1281
1281
Our app includes a Suspense-enabled router, with [page transitions already marked as Transitions](/reference/react/useTransition#building-a-suspense-enabled-router), which means navigations are performed with `startTranstion`:
1282
1282
1283
-
```js {2}
1283
+
```js
1284
1284
functionnavigate(url) {
1285
1285
startTransition(() => {
1286
1286
go(url);
@@ -1290,7 +1290,7 @@ function navigate(url) {
1290
1290
1291
1291
`startTransition` is a View Transition trigger, so we can add `<ViewTransition>` to animate between pages:
1292
1292
1293
-
```js {2,4}
1293
+
```js
1294
1294
// "what" to animate
1295
1295
<ViewTransition key={url}>
1296
1296
{url ==='/'?<Home />:<TalkDetails />}
@@ -2479,7 +2479,7 @@ For example, we can slow down the `default` cross fade animation:
2479
2479
2480
2480
And define `slow-fade` in CSS using [view transition classes](/reference/react/ViewTransition#view-transition-classes):
2481
2481
2482
-
```css {1,5}
2482
+
```css
2483
2483
::view-transition-old(.slow-fade) {
2484
2484
animation-duration: 500ms;
2485
2485
}
@@ -3673,7 +3673,7 @@ When two pages include the same element, often you want to animate it from one p
3673
3673
3674
3674
To do this you can add a unique `name` to the `<ViewTransition>`:
3675
3675
3676
-
```js {1,3}
3676
+
```js
3677
3677
<ViewTransition name={`video-${video.id}`}>
3678
3678
<Thumbnail video={video} />
3679
3679
</ViewTranstion>
@@ -4882,14 +4882,14 @@ Sometimes, you may want elements to animate differently based on how it was trig
4882
4882
```js {4,11}
4883
4883
functionnavigate(url) {
4884
4884
startTransition(() => {
4885
-
//✅ Transition type for the cause "nav forward"
4885
+
// Transition type for the cause "nav forward"
4886
4886
addTransitionType('nav-forward');
4887
4887
go(url);
4888
4888
});
4889
4889
}
4890
4890
functionnavigateBack(url) {
4891
4891
startTransition(() => {
4892
-
//✅ Transition type for the cause "nav backward"
4892
+
// Transition type for the cause "nav backward"
4893
4893
addTransitionType('nav-back');
4894
4894
go(url);
4895
4895
});
@@ -4911,7 +4911,7 @@ With transition types, you can provide custom animations via props to `<ViewTran
4911
4911
4912
4912
Here we pass a `share` prop to define how to animate based on the transiton type. When the share transition activates from `nav-forward`, the view transition class `slide-forward` is applied. When it's from `nav-back`, the `slide-back` animation is activated. Let's define these animations in CSS:
4913
4913
4914
-
```css {1,5,9,13}
4914
+
```css
4915
4915
::view-transition-old(.slide-forward) {
4916
4916
/* when sliding forward, the "old" page should slide out to left. */
4917
4917
animation: ...
@@ -10145,8 +10145,8 @@ We're now ready to share the API and how it works, so you can start testing it i
10145
10145
10146
10146
`<Activity>` is a new component to hide and show parts of the UI:
0 commit comments