Skip to content

Commit 936d53e

Browse files
bleucitronRomain Crestey
andcommitted
docs: 03-transition (#25)
* docs: 03-transition * docs: 03-animate 03-easing 03-action --------- Co-authored-by: Romain Crestey <[email protected]>
1 parent 6451476 commit 936d53e

File tree

5 files changed

+112
-107
lines changed

5 files changed

+112
-107
lines changed

documentation/docs/03-runtime/04-svelte-transition.md

Lines changed: 58 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: 'svelte/transition'
33
---
44

5-
The `svelte/transition` module exports seven functions: `fade`, `blur`, `fly`, `slide`, `scale`, `draw` and `crossfade`. They are for use with Svelte [`transitions`](/docs/element-directives#transition-fn).
5+
Le module `svelte/transition` exporte 7 fonctions : `fade`, `blur`, `fly`, `slide`, `scale`, `draw` et `crossfade`. Ces fonctions sont utilisables avec les [`transitions`](/docs/element-directives#transition-fn) Svelte.
66

77
## `fade`
88

@@ -20,23 +20,23 @@ in:fade={params}
2020
out:fade={params}
2121
```
2222

23-
Animates the opacity of an element from 0 to the current opacity for `in` transitions and from the current opacity to 0 for `out` transitions.
23+
Anime l'opacité d'un élément de 0 jusqu'à l'opacité courante pour les transitions de type `in` et depuis l'opacité courante vers 0 pour les transitions de type `out`.
2424

25-
`fade` accepts the following parameters:
25+
Les paramètres suivants peuvent être utilisés avec `fade` :
2626

27-
- `delay` (`number`, default 0) — milliseconds before starting
28-
- `duration` (`number`, default 400) — milliseconds the transition lasts
29-
- `easing` (`function`, default `linear`) — an [easing function](/docs/svelte-easing)
27+
* `delay` (`number`, par défaut 0) - millisecondes avant le démarrage
28+
* `duration` (`number`, par défaut 400) - durée de la transition en millisecondes
29+
* `easing` (`function`, par défaut `linear`) — une [fonction de lissage](/docs/svelte-easing)
3030

31-
You can see the `fade` transition in action in the [transition tutorial](https://learn.svelte.dev/tutorial/transition).
31+
Un exemple de transition de type `fade` est présenté dans le [tutoriel relatif aux transitions](https://learn.svelte.dev/tutorial/transition).
3232

3333
```svelte
3434
<script>
3535
import { fade } from 'svelte/transition';
3636
</script>
3737
3838
{#if condition}
39-
<div transition:fade={{ delay: 250, duration: 300 }}>fades in and out</div>
39+
<div transition:fade={{ delay: 250, duration: 300 }}>Apparaît et disparaît en s'estompant</div>
4040
{/if}
4141
```
4242

@@ -56,23 +56,23 @@ in:blur={params}
5656
out:blur={params}
5757
```
5858

59-
Animates a `blur` filter alongside an element's opacity.
59+
Anime le filtre de flou (`blur`) en même temps que l'opacité d'un élément.
6060

61-
`blur` accepts the following parameters:
61+
Les paramètres suivants peuvent être utilisés avec `blur` :
6262

63-
- `delay` (`number`, default 0) — milliseconds before starting
64-
- `duration` (`number`, default 400) — milliseconds the transition lasts
65-
- `easing` (`function`, default `cubicInOut`) — an [easing function](/docs/svelte-easing)
66-
- `opacity` (`number`, default 0) - the opacity value to animate out to and in from
67-
- `amount` (`number | string`, default 5) - the size of the blur. Supports css units (for example: `"4rem"`). The default unit is `px`
63+
* `delay` (`number`, par défaut 0) - millisecondes avant le démarrage
64+
* `duration` (`number`, par défaut 400) - durée de la transition en millisecondes
65+
* `easing` (`function`, par défaut `cubicInOut`) — une [fonction de lissage](/docs/svelte-easing)
66+
* `opacity` (`number`, par défaut 0) - opacité cible de l'animation
67+
* `amount` (`number | string`, par défaut 5) - la taille du flou. Supporte les unités CSS (par exemple : `"4rem"`). L'unité par défaut est `px`.
6868

6969
```svelte
7070
<script>
7171
import { blur } from 'svelte/transition';
7272
</script>
7373
7474
{#if condition}
75-
<div transition:blur={{ amount: 10 }}>fades in and out</div>
75+
<div transition:blur={{ amount: 10 }}>Apparaît et disparaît avec un flou</div>
7676
{/if}
7777
```
7878

@@ -92,19 +92,20 @@ in:fly={params}
9292
out:fly={params}
9393
```
9494

95-
Animates the x and y positions and the opacity of an element. `in` transitions animate from the provided values, passed as parameters to the element's default values. `out` transitions animate from the element's default values to the provided values.
95+
Anime les positions x, y et l'opacité d'un élément. Les transitions entrantes (`in`) permettent d'animer les propriétés depuis les valeurs spécifiées, passées en tant que paramètres, vers les valeurs par défaut. Les transitions sortantes (`out`) permettent quant à elles d'animer depuis les valeurs par défaut de l'élément vers les valeurs spécifiées.
9696

97-
`fly` accepts the following parameters:
97+
Les paramètres suivants peuvent être utilisés avec `fly` :
9898

99-
- `delay` (`number`, default 0) — milliseconds before starting
100-
- `duration` (`number`, default 400) — milliseconds the transition lasts
101-
- `easing` (`function`, default `cubicOut`) — an [easing function](/docs/svelte-easing)
102-
- `x` (`number | string`, default 0) - the x offset to animate out to and in from
103-
- `y` (`number | string`, default 0) - the y offset to animate out to and in from
104-
- `opacity` (`number`, default 0) - the opacity value to animate out to and in from
99+
* `delay` (`number`, par défaut 0) - millisecondes avant le démarrage
100+
* `duration` (`number`, par défaut 400) - durée de la transition en millisecondes
101+
* `easing` (`function`, par défaut `cubicOut`) — une [fonction de lissage](/docs/svelte-easing)
102+
* `x` (`number | string`, par défaut 0) - décalage horizontal de l'animation
103+
* `y` (`number | string`, par défaut 0) - décalage vertical de l'animation
104+
* `opacity` (`number`, par défaut 0) - opacité cible de l'animation
105105

106-
x and y use `px` by default but support css units, for example `x: '100vw'` or `y: '50%'`.
107-
You can see the `fly` transition in action in the [transition tutorial](https://learn.svelte.dev/tutorial/adding-parameters-to-transitions).
106+
x et y utilisent `px` par défaut mais supportent les unités CSS, par exemple `x: '100vw'` ou `y: '50%'`.
107+
108+
Un exemple de transition de type `fly` est présenté dans le [tutoriel relatif aux transitions](https://learn.svelte.dev/tutorial/adding-parameters-to-transitions).
108109

109110
```svelte
110111
<script>
@@ -116,7 +117,7 @@ You can see the `fly` transition in action in the [transition tutorial](https://
116117
<div
117118
transition:fly={{ delay: 250, duration: 300, x: 100, y: 500, opacity: 0.5, easing: quintOut }}
118119
>
119-
flies in and out
120+
apparaît et disparaît avec un déplacement
120121
</div>
121122
{/if}
122123
```
@@ -137,15 +138,14 @@ in:slide={params}
137138
out:slide={params}
138139
```
139140

140-
Slides an element in and out.
141-
142-
`slide` accepts the following parameters:
141+
L'animation de type `slide` permet de faire apparaître et disparaître un élément en glissant depuis et vers le haut.
143142

144-
- `delay` (`number`, default 0) — milliseconds before starting
145-
- `duration` (`number`, default 400) — milliseconds the transition lasts
146-
- `easing` (`function`, default `cubicOut`) — an [easing function](/docs/svelte-easing)
143+
Les paramètres suivants peuvent être utilisés avec `slide` :
147144

148-
* `axis` (`x` | `y`, default `y`) — the axis of motion along which the transition occurs
145+
* `delay` (`number`, par défaut 0) - millisecondes avant le démarrage
146+
* `duration` (`number`, par défaut 400) - durée de la transition en millisecondes
147+
* `easing` (`function`, par défaut `cubicOut`) — une [fonction de lissage](/docs/svelte-easing)
148+
* `axis` (`x` | `y`, par défaut `y`) — l'axe de déplacement utilisé pour la transition
149149

150150
```svelte
151151
<script>
@@ -155,7 +155,7 @@ Slides an element in and out.
155155
156156
{#if condition}
157157
<div transition:slide={{ delay: 250, duration: 300, easing: quintOut, axis: 'x' }}>
158-
slides in and out horizontally
158+
Apparaît et disparaît en glissant
159159
</div>
160160
{/if}
161161
```
@@ -176,15 +176,15 @@ in:scale={params}
176176
out:scale={params}
177177
```
178178

179-
Animates the opacity and scale of an element. `in` transitions animate from an element's current (default) values to the provided values, passed as parameters. `out` transitions animate from the provided values to an element's default values.
179+
Anime l'opacité et l'échelle d'un élément. Les transitions entrantes (`in`) s'animent à partir des valeurs fournies en paramètre vers les valeurs par défaut de l'élément, passées en paramètres. Les transitions sortantes (`out`) s'animent à partir des valeurs par défaut de l'élément vers les valeurs fournies en paramètre.
180180

181-
`scale` accepts the following parameters:
181+
Les paramètres suivants peuvent être utilisés avec `scale` :
182182

183-
- `delay` (`number`, default 0) — milliseconds before starting
184-
- `duration` (`number`, default 400) — milliseconds the transition lasts
185-
- `easing` (`function`, default `cubicOut`) — an [easing function](/docs/svelte-easing)
186-
- `start` (`number`, default 0) - the scale value to animate out to and in from
187-
- `opacity` (`number`, default 0) - the opacity value to animate out to and in from
183+
* `delay` (`number`, par défaut 0) - millisecondes avant le démarrage
184+
* `duration` (`number`, par défaut 400) - durée de la transition en millisecondes
185+
* `easing` (`function`, par défaut `cubicInOut`) — une [fonction de lissage](/docs/svelte-easing)
186+
* `start` (`number`, par défaut 0) - ratio d'agrandissement de l'animation
187+
* `opacity` (`number`, par défaut 0) - opacité cible de l'animation
188188

189189
```svelte
190190
<script>
@@ -194,7 +194,7 @@ Animates the opacity and scale of an element. `in` transitions animate from an e
194194
195195
{#if condition}
196196
<div transition:scale={{ duration: 500, delay: 500, opacity: 0.5, start: 0.5, easing: quintOut }}>
197-
scales in and out
197+
Apparaît et disparaît avec un zoom
198198
</div>
199199
{/if}
200200
```
@@ -215,16 +215,16 @@ in:draw={params}
215215
out:draw={params}
216216
```
217217

218-
Animates the stroke of an SVG element, like a snake in a tube. `in` transitions begin with the path invisible and draw the path to the screen over time. `out` transitions start in a visible state and gradually erase the path. `draw` only works with elements that have a `getTotalLength` method, like `<path>` and `<polyline>`.
218+
Anime le tracé d'un élément SVG, comme un serpent dans un tube. Les transitions entrantes (`in`) commencent avec le tracé non visible et dessinent le tracé. Les transitions sortantes (`out`) commencent avec le tracé visible et l'effacent au fur et à mesure. L'animation `draw` ne fonctionne qu'avec les éléments ayant la méthode `getTotalLength`, comme `<path>` et `<polyline>`.
219219

220-
`draw` accepts the following parameters:
220+
Les paramètres suivants peuvent être utilisés avec `draw` :
221221

222-
- `delay` (`number`, default 0) — milliseconds before starting
223-
- `speed` (`number`, default undefined) - the speed of the animation, see below.
224-
- `duration` (`number` | `function`, default 800) — milliseconds the transition lasts
225-
- `easing` (`function`, default `cubicInOut`) — an [easing function](/docs/svelte-easing)
222+
* `delay` (`number`, par défaut 0) - millisecondes avant le démarrage
223+
* `speed` (`number`, par défaut undefined) - vitesse de l'animation, voir ci-dessous.
224+
* `duration` (`number` | `function`, par défaut 800) - durée de la transition en millisecondes
225+
* `easing` (`function`, par défaut `cubicInOut`) — une [fonction de lissage](/docs/svelte-easing)
226226

227-
The `speed` parameter is a means of setting the duration of the transition relative to the path's length. It is a modifier that is applied to the length of the path: `duration = length / speed`. A path that is 1000 pixels with a speed of 1 will have a duration of `1000ms`, setting the speed to `0.5` will double that duration and setting it to `2` will halve it.
227+
Le paramètre de vitesse `speed` peut être utilisé à la place du paramètre durée `duration` pour spécifier la vitesse de la transition en fonction de la longueur totale du chemin. Il s'agit d'un coefficient permettant de calculer la durée de l'animation : `durée = longueur / vitesse` (`duration = length / speed`). Par exemple, un chemin qui mesure 1000 pixels de long avec une vitesse de 1 aura une durée de 1000ms. Avec une vitesse de `0.5`, l'animation aura un temps doublé. Avec une vitesse de `2`, l'animation sera deux fois plus lente.
228228

229229
```svelte
230230
<script>
@@ -250,14 +250,14 @@ The `speed` parameter is a means of setting the duration of the transition relat
250250

251251
> EXPORT_SNIPPET: svelte/transition#crossfade
252252
253-
The `crossfade` function creates a pair of [transitions](/docs/element-directives#transition-fn) called `send` and `receive`. When an element is 'sent', it looks for a corresponding element being 'received', and generates a transition that transforms the element to its counterpart's position and fades it out. When an element is 'received', the reverse happens. If there is no counterpart, the `fallback` transition is used.
253+
La fonction de fondu croisé `crossfade` crée deux [transitions](/docs/element-directives#transition-fn) appelées `send` et `receive`. Quand un élément est "envoyé", Svelte cherche un élément correspondant "reçu" et génère une transition qui déplace l'élément vers la position de sa contrepartie en le faisant disparaître. Quand un élément est "reçu", l'inverse s'applique. S'il n'y a pas d'élément reçu, la transition par défaut `fallback` s'applique.
254254

255-
`crossfade` accepts the following parameters:
255+
Les paramètres suivants peuvent être utilisés avec `crossfade` :
256256

257-
- `delay` (`number`, default 0) — milliseconds before starting
258-
- `duration` (`number` | `function`, default 800) — milliseconds the transition lasts
259-
- `easing` (`function`, default `cubicOut`) — an [easing function](/docs/svelte-easing)
260-
- `fallback` (`function`) — A fallback [transition](/docs/element-directives#transition-fn) to use for send when there is no matching element being received, and for receive when there is no element being sent.
257+
* `delay` (`number`, par défaut 0) - millisecondes avant le démarrage
258+
* `duration` (`number` | `function`, par défaut 800) - durée de la transition en millisecondes
259+
* `easing` (`function`, par défaut `cubicOut`) — une [fonction de lissage](/docs/svelte-easing)
260+
* `fallback` (`function`) — une [transition](/docs/element-directives#transition-fn) de secours à utiliser lorsqu'il n'y a pas d'élément "reçu" correspondant.
261261

262262
```svelte
263263
<script>
@@ -271,9 +271,9 @@ The `crossfade` function creates a pair of [transitions](/docs/element-directive
271271
</script>
272272
273273
{#if condition}
274-
<h1 in:send={{ key }} out:receive={{ key }}>BIG ELEM</h1>
274+
<h1 in:send={{ key }} out:receive={{ key }}>GROS ELEMENT</h1>
275275
{:else}
276-
<small in:send={{ key }} out:receive={{ key }}>small elem</small>
276+
<small in:send={{ key }} out:receive={{ key }}>petit élément</small>
277277
{/if}
278278
```
279279

documentation/docs/03-runtime/05-svelte-animate.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: 'svelte/animate'
33
---
44

5-
The `svelte/animate` module exports one function for use with Svelte [animations](/docs/element-directives#animate-fn).
5+
Le module `svelte/animate` exporte une fonction à utiliser avec les [animations](/docs/element-directives#animate-fn) Svelte.
66

77
## `flip`
88

@@ -12,20 +12,21 @@ The `svelte/animate` module exports one function for use with Svelte [animations
1212
animate:flip={params}
1313
```
1414

15-
The `flip` function calculates the start and end position of an element and animates between them, translating the `x` and `y` values. `flip` stands for [First, Last, Invert, Play](https://aerotwist.com/blog/flip-your-animations/).
15+
La méthode `flip` calcule la position de départ et d'arrivée d'un élément et génère une animation de translation des coordonnées `x` et `y`. Le mot `flip` est l'acronyme de [First, Last, Invert, Play](https://aerotwist.com/blog/flip-your-animations/) (en anglais).
1616

17-
`flip` accepts the following parameters:
17+
Les paramètres suivants peuvent être utilisés avec `flip` :
1818

19-
- `delay` (`number`, default 0) — milliseconds before starting
20-
- `duration` (`number` | `function`, default `d => Math.sqrt(d) * 120`) — see below
21-
- `easing` (`function`, default `cubicOut`) — an [easing function](/docs/svelte-easing)
19+
* `delay` (`number`, par défaut 0) - millisecondes avant le démarrage
20+
* `duration` (`number` | `function`, par défaut `d => Math.sqrt(d) * 120`) - voir ci-dessous
21+
* `easing` (`function`, par défaut `cubicOut`) — une [fonction de lissage](/docs/svelte-easing)
2222

23-
`duration` can be provided as either:
2423

25-
- a `number`, in milliseconds.
26-
- a function, `distance: number => duration: number`, receiving the distance the element will travel in pixels and returning the duration in milliseconds. This allows you to assign a duration that is relative to the distance travelled by each element.
24+
Le paramètre de durée `duration` peut être:
2725

28-
You can see a full example on the [animations tutorial](https://learn.svelte.dev/tutorial/animate).
26+
- soit un nombre, en millisecondes.
27+
- une fonction, `distance: number => duration: number`, dont le paramètre correspond à la distance que l'élément va parcourir en pixels et qui retourne la durée en millisecondes. Cela permet de définir une durée, relative à la distance parcourue de l'élément.
28+
29+
Un exemple complet est présenté dans le [tutoriel relatif aux animations](https://learn.svelte.dev/tutorial/animate).
2930

3031
```svelte
3132
<script>

documentation/docs/03-runtime/06-svelte-easing.md

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,23 @@
22
title: 'svelte/easing'
33
---
44

5-
Easing functions specify the rate of change over time and are useful when working with Svelte's built-in transitions and animations as well as the tweened and spring utilities. `svelte/easing` contains 31 named exports, a `linear` ease and 3 variants of 10 different easing functions: `in`, `out` and `inOut`.
5+
Les fonctions de lissage permettent de configurer la vitesse de transitions ou d'animations. Elles peuvent également être utilisées avec les <span class="vo">[stores](/docs/sveltejs#store)</span> [`tweened`](/docs/svelte-motion#tweened) et [`spring`](/docs/svelte-motion#spring). `svelte/easing` exporte 31 utilitaires, une fonction de lissage linéaire (`linear`), et 3 variantes de 10 différentes fonctions de lissage : `in`, `out` et `inOut`.
66

7-
You can explore the various eases using the [ease visualiser](/examples/easing) in the [examples section](/examples).
7+
Un exemple de chaque méthode est présenté dans le [démonstrateur des fonctions de lissage](/examples/easing) ainsi que dans la section d'[exemples](/examples).
88

9-
| ease | in | out | inOut |
10-
| ----------- | ----------- | ------------ | -------------- |
11-
| **back** | `backIn` | `backOut` | `backInOut` |
12-
| **bounce** | `bounceIn` | `bounceOut` | `bounceInOut` |
13-
| **circ** | `circIn` | `circOut` | `circInOut` |
14-
| **cubic** | `cubicIn` | `cubicOut` | `cubicInOut` |
9+
10+
| ease | in | out | inOut |
11+
| --- | --- | --- | --- |
12+
| **back** | `backIn` | `backOut` | `backInOut` |
13+
| **bounce** | `bounceIn` | `bounceOut` | `bounceInOut` |
14+
| **circ** | `circIn` | `circOut` | `circInOut` |
15+
| **cubic** | `cubicIn` | `cubicOut` | `cubicInOut` |
1516
| **elastic** | `elasticIn` | `elasticOut` | `elasticInOut` |
16-
| **expo** | `expoIn` | `expoOut` | `expoInOut` |
17-
| **quad** | `quadIn` | `quadOut` | `quadInOut` |
18-
| **quart** | `quartIn` | `quartOut` | `quartInOut` |
19-
| **quint** | `quintIn` | `quintOut` | `quintInOut` |
20-
| **sine** | `sineIn` | `sineOut` | `sineInOut` |
17+
| **expo** | `expoIn` | `expoOut` | `expoInOut` |
18+
| **quad** | `quadIn` | `quadOut` | `quadInOut` |
19+
| **quart** | `quartIn` | `quartOut` | `quartInOut` |
20+
| **quint** | `quintIn` | `quintOut` | `quintInOut` |
21+
| **sine** | `sineIn` | `sineOut` | `sineInOut` |
2122

2223
<!-- TODO -->
2324

0 commit comments

Comments
 (0)