Bonjour,
je tente une petite animation en css: un arc de cercle rouge d'une certaine taille qui disparaît en 10 secondes ( recouvert par un autre arc de cercle ).
J'ai ajouté une aiguille qui suit la disparition et heureusement, car sans aiguille il reste une petit "filet" rouge de l'arc de cercle !
Code html : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link rel="stylesheet" href="style.css"> <title>camembert</title> </head> <body> <div class="camembert"> <div class="aiguille"></div> <div class="part part1"></div> <div class="part part2"></div> </div> </body> </html>
Code CSS : Sélectionner tout - Visualiser dans une fenêtre à part
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 * { margin: 0; padding: 0; box-sizing: border-box; } .camembert { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 200px; height: 200px; border-radius: 50%; } .aiguille { z-index: 10; position: absolute; left: 50%; width: 2px; height: 100%; background: linear-gradient(blue 50%, white 50%); transform: translate(-50%, 0) rotateZ(30deg); transform-origin: center; animation: rebour 10s linear forwards; } .part { position: absolute; width: 100%; height: 100%; border-radius: 50%; clip-path: polygon(50% 50%, 50% 0%, 100% 0, 100% 50%, 100% 100%, 50% 100%); } .part1 { background-color: #e74c3c; /* border: 1px solid white; */ } .part2 { animation: rebour 10s linear forwards; background-color: white; transform: rotateZ(30deg); } @keyframes rebour { to { transform: rotateZ(0deg); } }
Essayez en commentant la div aiguille et la bordure de la classe "part1", qui servent à masquer le problème
Dans ce cas , à la fin de l'animation, vous devriez voir apparaître un beau demi cercle blanc entouré d'une très fine bordure rouge !
Si quelqu'un sait pourquoi on obtient ce résultat et s'il y a un moyen simple de corriger ça, je le remercie d'avance.
Pour l'instant, ma solution me convient, mais je ne m'attendais pas à ce résultat, qui ne me semble pas logique.
Merci d'avance,
Laurent.
Partager