-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
201 lines (201 loc) · 6.51 KB
/
index.html
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>蝶恋花 🌹</title>
<link href="https://fonts.googleapis.com/css2?family=Ma+Shan+Zheng&display=swap" rel="stylesheet">
<style>
body, html {
margin: 0;
padding: 0;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
background-color: #FAFAFA;
font-family: 'Ma Shan Zheng', cursive;
color: #333;
}
body {
padding: 20px;
box-sizing: border-box;
}
.card {
width: calc(90vw - 40px);
max-width: 360px;
height: calc(135vw - 60px);
max-height: 540px;
background: linear-gradient(135deg, #FFE6E6, #FFF0F5);
border-radius: 20px;
box-shadow: 0 10px 30px rgba(0,0,0,0.2);
padding: 8vw;
display: flex;
flex-direction: column;
justify-content: flex-start;
position: relative;
overflow: hidden;
}
.poem {
display: flex;
flex-direction: row-reverse;
justify-content: flex-start;
align-items: flex-start;
height: 100%;
margin-top: 10vw;
}
.poem-line {
font-size: 8vw;
max-font-size: 36px;
writing-mode: vertical-rl;
text-orientation: upright;
text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
margin-left: 7.5vw;
z-index: 2;
}
.poem-line:first-child {
margin-top: -5vw;
}
.poem-line:last-child {
margin-top: 15vw;
}
.title {
position: absolute;
left: 5vw;
bottom: 10vw;
writing-mode: vertical-rl;
text-orientation: upright;
font-size: 7vw;
max-font-size: 32px;
color: #555;
text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
z-index: 2;
}
.title::before {
content: "︱";
display: block;
margin-bottom: 2.5vw;
font-size: 6vw;
max-font-size: 24px;
}
.author {
position: absolute;
right: 5vw;
bottom: 10vw;
writing-mode: vertical-rl;
text-orientation: upright;
font-size: 7vw;
max-font-size: 32px;
color: #555;
text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
z-index: 2;
}
.flower-petals {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 1;
pointer-events: none;
}
.petal {
position: absolute;
background-color: #FF69B4;
opacity: 0.6;
border-radius: 50%;
animation: fall 10s linear infinite;
}
@keyframes fall {
0% {
transform: translateY(-5%) rotate(0deg);
}
100% {
transform: translateY(105%) rotate(360deg);
}
}
.swing {
position: absolute;
bottom: 25vw;
right: 15vw;
width: 25vw;
max-width: 100px;
height: 0.5vw;
max-height: 2px;
background-color: #8B4513;
transform-origin: 50% -50vw;
animation: swing 5s ease-in-out infinite;
z-index: 1;
}
@keyframes swing {
0%, 100% { transform: rotate(10deg); }
50% { transform: rotate(-10deg); }
}
@media (min-width: 600px) {
.card {
padding: 40px;
}
.poem-line {
font-size: 36px;
margin-left: 30px;
}
.poem-line:first-child {
margin-top: -20px;
}
.poem-line:last-child {
margin-top: 60px;
}
.title, .author {
font-size: 32px;
}
.title::before {
font-size: 24px;
margin-bottom: 10px;
}
.swing {
bottom: 100px;
right: 60px;
width: 100px;
height: 2px;
transform-origin: 50% -200px;
}
}
</style>
</head>
<body>
<div class="card">
<div class="flower-petals">
<div class="petal" style="left: 20%; top: -10%; width: 5vw; height: 5vw; max-width: 20px; max-height: 20px;"></div>
<div class="petal" style="left: 40%; top: -5%; width: 3.75vw; height: 3.75vw; max-width: 15px; max-height: 15px;"></div>
<div class="petal" style="left: 60%; top: -8%; width: 4.5vw; height: 4.5vw; max-width: 18px; max-height: 18px;"></div>
<div class="petal" style="left: 80%; top: -12%; width: 5.5vw; height: 5.5vw; max-width: 22px; max-height: 22px;"></div>
</div>
<div class="swing"></div>
<div class="poem">
<div class="poem-line">泪眼问花花不语</div>
<div class="poem-line">乱红飞过秋千去</div>
</div>
<div class="title">蝶恋花</div>
<div class="author">欧阳修</div>
</div>
<script>
function createPetals(num) {
const flowerPetals = document.querySelector('.flower-petals');
for (let i = 0; i < num; i++) {
const petal = document.createElement('div');
petal.classList.add('petal');
petal.style.left = `${Math.random() * 100}%`;
petal.style.top = `${Math.random() * 100}%`;
const size = Math.random() * 2.5 + 2.5;
petal.style.width = `${size}vw`;
petal.style.height = `${size}vw`;
petal.style.maxWidth = `${size * 4}px`;
petal.style.maxHeight = `${size * 4}px`;
petal.style.animationDelay = `${Math.random() * 10}s`;
flowerPetals.appendChild(petal);
}
}
createPetals(20);
</script>
</body>
</html>