aboutsummaryrefslogtreecommitdiff
path: root/files/fr/web/svg/element/animatemotion/index.md
blob: 248868dd83838023ff724666146ac32a059015d7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
---
title: animateMotion
slug: Web/SVG/Element/animateMotion
tags:
  - Animation SVG
  - Element
  - SVG
translation_of: Web/SVG/Element/animateMotion
---
{{SVGRef}}

L'élément **`<animateMotion>`** permet d'animer un élément le long d'un chemin donné.

## Contexte d'utilisation

{{svginfo}}

## Attributs

### Attributs globaux

- [Attributs à traitement conditionnel](/fr/docs/Web/SVG/Attribute#ConditionalProccessing) »
- [Attributs fondamentaux](/fr/docs/Web/SVG/Attribute#Core) »
- [Attributs d'événements d'animation](/fr/docs/SVG/Attribute#AnimationEvent) »
- [Attributs XLink](/fr/docs/Web/SVG/Attribute#XLink) »
- [Attributs d'animation de timing](/fr/docs/SVG/Attribute#AnimationTiming "SVG/Attribute#AnimationTiming") »
- [Attributs d'animation de valeurs](/fr/docs/SVG/Attribute#AnimationValue "SVG/Attribute#AnimationValue") »
- [Attributs d'animation d'ajout](/fr/docs/SVG/Attribute#AnimationAddition "SVG/Attribute#AnimationAddition") »
- {{ SVGAttr("externalResourcesRequired") }}

### Attributs spécifiques

- {{ SVGAttr("calcMode") }}
- {{ SVGAttr("path") }}
- {{ SVGAttr("keyPoints") }}
- {{ SVGAttr("rotate") }}
- {{ SVGAttr("origin") }}

## Interface DOM

Cet élément implémente l'interface [`SVGAnimateMotionElement`](/fr/docs/DOM/SVGAnimateMotionElement "en/DOM/SVGAnimateMotionElement").

## Exemple

### SVG

```html
<?xml version="1.0"?>
<svg width="120" height="120" viewBox="0 0 120 120"
    xmlns="http://www.w3.org/2000/svg" version="1.1"
    xmlns:xlink="http://www.w3.org/1999/xlink">

  <!-- Dessine le chemin en gris, avec 2 cercles aux extrémités -->
  <path d="M10,110 A120,120 -45 0,1 110 10 A120,120 -45 0,1 10,110"
      stroke="lightgrey" stroke-width="2"
      fill="none" id="theMotionPath"/>
  <circle cx="10" cy="110" r="3" fill="lightgrey"  />
  <circle cx="110" cy="10" r="3" fill="lightgrey"  />

  <!-- Cercle rouge qui sera déplacé le long du chemin. -->
  <circle cx="" cy="" r="5" fill="red">

    <!-- Définit l'animation -->
    <animateMotion dur="6s" repeatCount="indefinite">
      <mpath xlink:href="#theMotionPath"/>
    </animateMotion>
  </circle>
</svg>
```

### Résultat

{{EmbedLiveSample("Exemple", 120, 120)}}

## Spécifications

| Spécification                                                                                                    | Statut                                   | Commentaire         |
| ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------- | ------------------- |
| {{SpecName("SVG Animations 2", "#AnimateMotionElement", "&lt;animateMotion&gt;")}}     | {{Spec2("SVG Animations 2")}} | Aucun changement    |
| {{SpecName('SVG1.1', 'animate.html#AnimateMotionElement', '&lt;animateMotion&gt;')}} | {{Spec2('SVG1.1')}}                 | Définition initiale |

## Compatibilité des navigateurs

{{Compat("svg.elements.animateMotion")}}

## Voir aussi

- {{ SVGElement("mpath") }}