diff options
author | SphinxKnight <SphinxKnight@users.noreply.github.com> | 2022-03-18 07:03:30 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-18 07:03:30 +0100 |
commit | 371b1302c5ab1ed0c461eb389e6b91d270e219bd (patch) | |
tree | fcea74f16afe52be8f34d63e6960ab89ee327de5 /files/fr/web/api/canvas_api/tutorial | |
parent | c32682b053bad2602a8c910cc7e4106acaefade1 (diff) | |
download | translated-content-371b1302c5ab1ed0c461eb389e6b91d270e219bd.tar.gz translated-content-371b1302c5ab1ed0c461eb389e6b91d270e219bd.tar.bz2 translated-content-371b1302c5ab1ed0c461eb389e6b91d270e219bd.zip |
fixes 4269-introduced breakage (#4697)
Diffstat (limited to 'files/fr/web/api/canvas_api/tutorial')
-rw-r--r-- | files/fr/web/api/canvas_api/tutorial/drawing_shapes/index.md | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/files/fr/web/api/canvas_api/tutorial/drawing_shapes/index.md b/files/fr/web/api/canvas_api/tutorial/drawing_shapes/index.md index 57d00b74d8..35811261e3 100644 --- a/files/fr/web/api/canvas_api/tutorial/drawing_shapes/index.md +++ b/files/fr/web/api/canvas_api/tutorial/drawing_shapes/index.md @@ -262,29 +262,29 @@ L'instruction pour le paramètre `antihoraire` a pour résultat que la première ``` ```js -function dessiner() { - var canevas = document.getElementById('canevas'); - if (canevas.getContext) { - var ctx = canevas.getContext('2d'); - - for(var i = 0; i < 4 - for(var j = 0; j < +function draw() { + var canvas = document.getElementById('canevas'); + if (canvas.getContext) { + var ctx = canvas.getContext('2d'); + + for (var i = 0; i < 4; i++) { + for (var j = 0; j < 3; j++) { ctx.beginPath(); - var x = 25 + j * 50; // Coordonné - var y = 25 + i * 50; // Coordonné - var rayon = 20; // Rayon de l'arc - var angleInitial = 0; // Point de départ sur le cercle - var angleFinal = Math.PI + (Math.PI * j) / 2; // Point d - var antihoraire - - - - f - - - - - } + var x = 25 + j * 50; // abscisse (x) + var y = 25 + i * 50; // ordonnée (y) + var radius = 20; // rayon d'arc + var startAngle = 0; // Point de départ du cercle + var endAngle = Math.PI + (Math.PI * j) / 2; // Point final pour le cercle + var counterclockwise = i % 2 !== 0; // sens de rotation horaire ou non + + ctx.arc(x, y, radius, startAngle, endAngle, counterclockwise); + + if (i > 1) { + ctx.fill(); + } else { + ctx.stroke(); + } + } } } } |