Skip to content

Commit dd0f573

Browse files
Fabio ParisiFabio Parisi
authored andcommitted
Let's go
0 parents  commit dd0f573

File tree

1 file changed

+119
-0
lines changed

1 file changed

+119
-0
lines changed

index.html

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
<!DOCTYPE html>
2+
<html lang="fr">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<title>Think2 - Effet flip</title>
6+
<style>
7+
body {
8+
margin: 0;
9+
padding: 0;
10+
background: #f0f0f0;
11+
font-family: Arial, sans-serif;
12+
}
13+
14+
#logo {
15+
position: absolute;
16+
top: 20px;
17+
left: 20px;
18+
font-size: 2rem; /* Ajustez si besoin */
19+
font-weight: bold;
20+
}
21+
22+
.flip-container {
23+
display: inline-block;
24+
width: 3em; /* ← augmentée pour loger “twice” */
25+
height: 1.1em; /* Ajustez si besoin pour la hauteur */
26+
position: relative;
27+
perspective: 600px;
28+
margin-left: 8px;
29+
}
30+
31+
.flip-face {
32+
position: absolute;
33+
width: 100%;
34+
height: 100%;
35+
line-height: 1.1em;
36+
text-align: center;
37+
backface-visibility: hidden;
38+
border: 2px solid #333;
39+
border-radius: 6px;
40+
background: #333;
41+
color: #fff;
42+
font-weight: bold;
43+
transform-origin: bottom;
44+
display: flex;
45+
align-items: center;
46+
justify-content: center;
47+
}
48+
49+
.front {
50+
transform: rotateX(0deg);
51+
z-index: 2;
52+
}
53+
54+
.back {
55+
transform: rotateX(180deg);
56+
}
57+
58+
/* Animations */
59+
.flip-animate .front {
60+
animation: flipFront 0.6s forwards;
61+
}
62+
.flip-animate .back {
63+
animation: flipBack 0.6s forwards;
64+
}
65+
66+
@keyframes flipFront {
67+
0% {
68+
transform: rotateX(0deg);
69+
}
70+
100% {
71+
transform: rotateX(-180deg);
72+
}
73+
}
74+
75+
@keyframes flipBack {
76+
0% {
77+
transform: rotateX(180deg);
78+
}
79+
100% {
80+
transform: rotateX(0deg);
81+
}
82+
}
83+
</style>
84+
</head>
85+
<body>
86+
87+
<div id="logo">
88+
Think
89+
<div class="flip-container" id="flip-container">
90+
<div class="flip-face front" id="front-face">2</div>
91+
<div class="flip-face back" id="back-face"></div>
92+
</div>
93+
</div>
94+
95+
<script>
96+
const textes = ["2", "too", "twice"];
97+
let currentIndex = 0;
98+
99+
const flipContainer = document.getElementById('flip-container');
100+
const frontFace = document.getElementById('front-face');
101+
const backFace = document.getElementById('back-face');
102+
103+
function flipToNext() {
104+
let nextIndex = (currentIndex + 1) % textes.length;
105+
let nextText = textes[nextIndex];
106+
backFace.textContent = nextText;
107+
flipContainer.classList.add('flip-animate');
108+
109+
setTimeout(() => {
110+
frontFace.textContent = nextText;
111+
flipContainer.classList.remove('flip-animate');
112+
currentIndex = nextIndex;
113+
}, 600);
114+
}
115+
116+
setInterval(flipToNext, 1000);
117+
</script>
118+
</body>
119+
</html>

0 commit comments

Comments
 (0)