1. <!DOCTYPE html>
    2. <html lang="en">
    3. <head>
    4. <meta charset="UTF-8">
    5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
    6. <meta name="viewport" content="width=device-width, initial-scale=0.2">
    7. <title>Document</title>
    8. </head>
    9. <body>
    10. <div class="wrap">
    11. <!-- ice dwen's body -->
    12. <div class="body"></div>
    13. <!-- ice dwen's ears -->
    14. <div class="ear"></div>
    15. <div class="ear rightEar"></div>
    16. <!-- ice dwen's hands -->
    17. <div class="leftHand"></div>
    18. <div class="rightHand"></div>
    19. <!-- ice dwen's foots -->
    20. <div class="leftFoot"></div>
    21. <div class="rightFoot"></div>
    22. <!-- my heart -->
    23. <div class="heart"></div>
    24. <!-- ice dwen's green face -->
    25. <div class="greenFace"></div>
    26. <!-- ice dwen's blue face -->
    27. <div class="blueFace"></div>
    28. <!-- ice dwen's pink face -->
    29. <div class="pinkFace"></div>
    30. <!-- ice dwen's yellow face -->
    31. <div class="yellowFace"></div>
    32. <!-- ice dwen's black face -->
    33. <div class="blackFace"></div>
    34. <!-- ice dwen's eyes -->
    35. <div class="leftEye"></div>
    36. <div class="rightEye"></div>
    37. <!-- ice dwen's nose -->
    38. <div class="nose"></div>
    39. <!-- ice dwen's mouth -->
    40. <div class="mouth"></div>
    41. <!-- ice dwen's chin -->
    42. <div class="chin"></div>
    43. <!-- ice dwen's belly -->
    44. <div class="belly">
    45. <img src="https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fnimg.ws.126.net%2F%3Furl%3Dhttp%3A%2F%2Fdingyue.ws.126.net%2F2021%2F0406%2F13a7569fp00qr5c3q00bec000tu00jkc.png%26thumbnail%3D650x2147483647%26quality%3D80%26type%3Djpg&refer=http%3A%2F%2Fnimg.ws.126.net&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1648996526&t=8c61fa004d82ab9fd7fa9f7fd90572aa"
    46. alt="你真好看!花束">
    47. </div>
    48. </div>
    49. <style>
    50. body,
    51. html {
    52. /* 请求浏览器内外边距 */
    53. margin: 0;
    54. padding: 0;
    55. /* 设为怪异盒子模型 */
    56. box-sizing: border-box;
    57. transform: scale(0.65);
    58. }
    59. body {
    60. margin: 0px;
    61. width: 100%;
    62. height: 100%;
    63. background-image: linear-gradient(to top, #fff1eb 0%, #ace0f9 100%);
    64. }
    65. /* 放置冰墩墩的盒子 */
    66. .wrap {
    67. /* 绝对定位 */
    68. position: relative;
    69. margin-left: 279px;
    70. margin-top: 139px;
    71. height: 948px;
    72. width: 837px;
    73. }
    74. /* 椭圆身体 */
    75. .body {
    76. height: 100%;
    77. width: 100%;
    78. border: 16px solid #000;
    79. /* 使用相对定位 */
    80. position: absolute;
    81. /* border-radius属性可以绘制一个椭圆作为身体 */
    82. border-radius: 55% 55% 55% 55% / 50% 50% 60% 60%;
    83. top: 0;
    84. left: 0;
    85. background: #fff;
    86. /* 层级最高 让身体显示在耳朵上面 */
    87. z-index: 1;
    88. }
    89. /* 左耳 */
    90. .ear {
    91. width: 250px;
    92. height: 334px;
    93. /* 使用相对定位将耳朵放在正确位置 */
    94. position: absolute;
    95. top: 0;
    96. left: 55px;
    97. border: 16px solid #000;
    98. border-radius: 50% 60% 60% 50% / 50% 50% 50% 50%;
    99. background: #000;
    100. /* 堆叠层次 实现左耳 */
    101. z-index: 0;
    102. /* 使用旋转属性将耳朵放置正确位置 */
    103. transform: rotate(-20deg);
    104. }
    105. /* 右耳 */
    106. .rightEar {
    107. /* 右耳添加类名 同样属性 旋转角度调整 */
    108. right: 55px;
    109. left: auto;
    110. transform: rotateY(180deg) rotate(-20deg);
    111. }
    112. /* 左手 */
    113. .leftHand {
    114. position: absolute;
    115. z-index: 0;
    116. width: 223px;
    117. height: 362px;
    118. border-radius: 50%;
    119. background: #000;
    120. /* 左手定位 */
    121. top: 280px;
    122. left: -140px;
    123. /* 左手旋转到合适位置 */
    124. transform: rotate(-15deg);
    125. }
    126. .leftHand:after {
    127. position: absolute;
    128. top: 195px;
    129. content: '';
    130. width: 362px;
    131. height: 223px;
    132. background: #000;
    133. border-radius: 50%;
    134. transform: rotate(35deg);
    135. }
    136. /* 右手 */
    137. .rightHand {
    138. /* 右手定位 将右手定位到合适位置 */
    139. position: absolute;
    140. right: -210px;
    141. top: 470px;
    142. /* 设置堆叠层次 不淹没身体 */
    143. z-index: 0;
    144. height: 223px;
    145. width: 223px;
    146. border-radius: 50%;
    147. background: #000;
    148. }
    149. /* 右手设置样式 使用:after */
    150. .rightHand:after {
    151. /* 与左手同理 使用定位定到合适位置 */
    152. position: absolute;
    153. top: -66px;
    154. left: -70px;
    155. background: #000;
    156. width: 220px;
    157. height: 223px;
    158. content: '';
    159. transform: rotate(-47deg);
    160. border-radius: 0 0 0 80%;
    161. }
    162. /* 左脚 */
    163. .leftFoot {
    164. /* 将左脚定位到指定位置 */
    165. position: absolute;
    166. top: 840px;
    167. left: 80px;
    168. width: 250px;
    169. height: 250px;
    170. border-radius: 50%;
    171. background: #000;
    172. }
    173. .leftFoot:after {
    174. /* 将左脚定位到固定位置 这不是完整的左脚 */
    175. position: absolute;
    176. /* 设置堆叠层次 */
    177. z-index: 0;
    178. content: '';
    179. background: #000;
    180. height: 250px;
    181. width: 250px;
    182. left: 30px;
    183. top: -125px;
    184. /* 旋转10度到合适位置 */
    185. transform: rotate(10deg);
    186. /* 设置圆角属性 椭圆 */
    187. border-radius: 0% 50% 50% 0%;
    188. }
    189. /* 右脚 */
    190. .rightFoot {
    191. background: #000;
    192. width: 250px;
    193. height: 250px;
    194. /* 将有较定位到合适位置 */
    195. position: absolute;
    196. top: 840px;
    197. right: 80px;
    198. border-radius: 50%;
    199. }
    200. /* 右脚的腿杆 其实有点粗 是个柱子 */
    201. .rightFoot:after {
    202. content: '';
    203. /* 设置她的腿粗细 */
    204. width: 250px;
    205. height: 250px;
    206. /* 将这个柱子定位到合适位置 */
    207. position: absolute;
    208. top: -125px;
    209. right: 28px;
    210. z-index: 0;
    211. background: #000;
    212. transform: rotate(-12deg);
    213. border-radius: 0% 0% 0% 50%;
    214. }
    215. /* 把心给你 */
    216. .heart {
    217. width: 140px;
    218. height: 140px;
    219. /* 一定取消这个背景颜色 利用伪类设置背景颜色!!!!! */
    220. /* background: red; */
    221. position: absolute;
    222. top: 350px;
    223. left: -90px;
    224. z-index: 2;
    225. }
    226. /* 实现爱心的重要步骤 */
    227. .heart:before,
    228. .heart:after {
    229. content: '';
    230. position: absolute;
    231. top: 0;
    232. width: 33px;
    233. height: 55px;
    234. background: red;
    235. border-radius: 55px 55px 0% 0%;
    236. }
    237. /* 使用transform */
    238. .heart:after {
    239. transform: rotate(45deg);
    240. right: 90px;
    241. }
    242. .heart:before {
    243. transform: rotate(-45deg);
    244. left: 0;
    245. }
    246. /* 脸上绿色的圈圈 */
    247. .greenFace {
    248. width: 661px;
    249. height: 517px;
    250. border: 10px solid #6cf078;
    251. /* 绿色是的脸已经可以了 */
    252. border-radius: 60% 60% 50% 50% /70% 70% 50% 50%;
    253. /* 接下来定位到脑壳中间去 */
    254. position: absolute;
    255. top: 95px;
    256. left: 83px;
    257. /* z-index: inherit; */
    258. z-index: 1;
    259. /* */
    260. }
    261. /* 蓝色的脸 */
    262. .blueFace {
    263. width: 642px;
    264. height: 501px;
    265. border: 10px solid yellow;
    266. /* 蓝色是的脸已经可以了 */
    267. border-radius: 60% 60% 50% 50% /70% 70% 50% 50%;
    268. /* 接下来定位到脑壳中间去 */
    269. position: absolute;
    270. top: 103px;
    271. left: 92px;
    272. /* z-index: inherit; */
    273. z-index: 1;
    274. /* */
    275. }
    276. /* 粉红色的脸 */
    277. .pinkFace {
    278. width: 619px;
    279. height: 480px;
    280. border: 10px solid red;
    281. /* 蓝色是的脸已经可以了 */
    282. border-radius: 60% 60% 50% 50% /70% 70% 50% 50%;
    283. /* 接下来定位到脑壳中间去 */
    284. position: absolute;
    285. top: 113px;
    286. left: 104px;
    287. /* z-index: inherit; */
    288. z-index: 1;
    289. /* */
    290. }
    291. /* 黄色的脸 */
    292. .yellowFace {
    293. width: 591px;
    294. height: 451px;
    295. border: 13px solid #335fe6;
    296. /* 黄色是的脸已经可以了 */
    297. border-radius: 60% 60% 50% 50% /70% 70% 50% 50%;
    298. /* 接下来定位到脑壳中间去 */
    299. position: absolute;
    300. top: 125px;
    301. left: 115px;
    302. /* z-index: inherit; */
    303. z-index: 1;
    304. /* */
    305. }
    306. /* 黑色的脸 */
    307. .blackFace {
    308. width: 567px;
    309. height: 422px;
    310. border: 13px solid #000;
    311. /* 黄色是的脸已经可以了 */
    312. border-radius: 60% 60% 50% 50% /70% 70% 50% 50%;
    313. /* 接下来定位到脑壳中间去 */
    314. position: absolute;
    315. top: 137px;
    316. left: 126px;
    317. /* z-index: inherit; */
    318. z-index: 1;
    319. /* */
    320. }
    321. /* 左眼 */
    322. .leftEye {
    323. /* 设置眼睛大小 */
    324. width: 168px;
    325. height: 222px;
    326. background: #000;
    327. /* 设置堆叠层级,眼睛高于身体 */
    328. /* 先实现一个圆的眼睛 通过:after设置椭圆眼睛 */
    329. border-radius: 50%;
    330. z-index: 2;
    331. /* 将眼睛旋转45度 */
    332. transform: rotate(45deg);
    333. position: absolute;
    334. top: 222px;
    335. left: 180px;
    336. }
    337. /* 右眼 */
    338. .rightEye {
    339. /* 设置眼睛大小 */
    340. width: 168px;
    341. height: 222px;
    342. background: #000;
    343. /* 设置堆叠层级,眼睛高于身体 */
    344. /* 先实现一个圆的眼睛 通过:after设置椭圆眼睛 */
    345. border-radius: 50%;
    346. z-index: 2;
    347. /* 将眼睛旋转45度 右眼定位和旋转都与左眼相反 */
    348. transform: rotate(-45deg);
    349. /* 使用定位将眼睛放置合适位置 */
    350. position: absolute;
    351. top: 222px;
    352. right: 180px;
    353. }
    354. /* 眼球白色部分 */
    355. .rightEye:after,
    356. .leftEye:after {
    357. position: absolute;
    358. width: 84px;
    359. height: 84px;
    360. border: 8px solid #fff;
    361. border-radius: 50%;
    362. content: '';
    363. top: 28px;
    364. left: 35px;
    365. }
    366. /* 右眼 */
    367. .rightEye:after {
    368. left: auto;
    369. right: 35px;
    370. }
    371. /* 眼球白色部分 */
    372. .rightEye:before,
    373. .leftEye:before {
    374. position: absolute;
    375. top: 64px;
    376. left: 64px;
    377. background: #fff;
    378. border-radius: 50%;
    379. content: '';
    380. width: 28px;
    381. height: 28px;
    382. }
    383. /* 右眼 */
    384. .rightEye:before {
    385. left: 70px;
    386. top: 56px;
    387. }
    388. /* 鼻子 */
    389. .nose {
    390. width: 84px;
    391. height: 84px;
    392. background: #000;
    393. /* 将鼻子放置合适位置 */
    394. position: absolute;
    395. left: 50%;
    396. margin-left: -42px;
    397. top: 350px;
    398. /* 设置鼻子堆叠层数 不会被身体遮掩 */
    399. z-index: 1;
    400. border-radius: 30%;
    401. /* 使用旋转和斜切将鼻子放置合适位置 */
    402. transform: rotate(50deg) skewY(-10deg);
    403. }
    404. /* 接下来给鼻子做个手术吧 */
    405. .nose:after {
    406. content: '';
    407. /* 开始给鼻子做手术了 */
    408. width: 103px;
    409. height: 108px;
    410. border-radius: 50%;
    411. /* 设置上边框 */
    412. border-top: 28px solid #fff;
    413. /* 使用定位将鼻子啮合 */
    414. position: absolute;
    415. top: -17px;
    416. left: 0px;
    417. /* 使用斜切补鼻子 */
    418. transform: rotate(-45deg) skewY(0deg);
    419. }
    420. /* 嘴巴 */
    421. .mouth {
    422. width: 265px;
    423. height: 120px;
    424. border: 14px solid #000;
    425. /* 设置定位把嘴巴放置合适位置 */
    426. position: absolute;
    427. top: 400px;
    428. left: 50%;
    429. /* 设置嘴巴堆叠层次 防止被遮掩 */
    430. z-index: 1;
    431. /* 距离左边间隔 */
    432. margin-left: -140px;
    433. /* 设置嘴巴边框 形状 */
    434. border-radius: 0% 0% 50% 50% / 0% 0% 100% 100%;
    435. /* 上边框为空 不要上边框 */
    436. border-top: none;
    437. }
    438. .mouth:after,
    439. .mouth:before {
    440. content: '';
    441. /* 使用定位将嘴巴放置合适位置 */
    442. position: absolute;
    443. width: 140px;
    444. height: 140px;
    445. background: #fff;
    446. top: -30px;
    447. /* 旋转角度 */
    448. transform: rotate(45deg);
    449. }
    450. .mouth:after {
    451. left: -60px;
    452. }
    453. .mouth:before {
    454. right: -60px;
    455. }
    456. /* 肚子上的图标 方丈图片吧 */
    457. .belly {
    458. width: 150px;
    459. height: 150px;
    460. position: absolute;
    461. top: 72%;
    462. left: 45%;
    463. margin-left: -25px;
    464. z-index: 1;
    465. }
    466. .belly img {
    467. width: 150px;
    468. height: 150px;
    469. }
    470. </style>
    471. <script>
    472. /* 注:后续发现黄色的脸和蓝色的脸很奇怪,我把颜色改了 */
    473. (() => {
    474. "use strict";
    475. var i = {
    476. 138: (i, t, s) => {
    477. class h {
    478. constructor(i = {}) {
    479. this.isRain = i.isRain || !1, this.el = null, this.dir = i.dir || "r", this
    480. .width = 0, this.maxWidth = i.maxWidth || 80, this.minWidth = i
    481. .minWidth || 2, this.opacity = 0, this.x = 0, this.y = 0, this.z = 0,
    482. this.sx = 0, this.isSwing = !1, this.stepSx = .02, this.swingRadian = 1,
    483. this.swingStep = .01, this.sy = 0, this.maxSpeed = i.maxSpeed || 4, this
    484. .minSpeed = i.minSpeed || 1, this.quickMaxSpeed = i.quickMaxSpeed || 10,
    485. this.quickMinSpeed = i.quickMinSpeed || 8, this.quickWidth = i
    486. .quickWidth || 80, this.quickOpacity = i.quickOpacity || .2, this
    487. .windowWidth = window.innerWidth, this.windowHeight = window
    488. .innerHeight, this.init()
    489. }
    490. init(i) {
    491. let t = Math.random() > .8;
    492. this.isSwing = Math.random() > .8, this.width = t ? this.quickWidth : Math
    493. .floor(Math.random() * this.maxWidth + this.minWidth), this.opacity =
    494. t ? this.quickOpacity : Math.random(), this.x = Math.floor(Math
    495. .random() * (this.windowWidth - this.width)), this.y = Math.floor(
    496. Math
    497. .random() * (this.windowHeight - this.width)), i && Math.random() >
    498. .8 ? this.x = -this.width : i && (this.y = -this.width), this.sy = t ?
    499. Math.random() * this.quickMaxSpeed + this.quickMinSpeed : Math
    500. .random() * this.maxSpeed + this.minSpeed, this.sx = "r" === this.dir ?
    501. this
    502. .sy : -this.sy, this.z = t ? 300 * Math.random() + 200 : 0, this
    503. .swingStep = .01 * Math.random(), this.swingRadian = Math.random() * (
    504. 1.1 - .9) + .9
    505. }
    506. setStyle() {
    507. this.el.style.cssText =
    508. `\n position: fixed;\n left: 0;\n top: 0;\n display: block;\n width: ${this.isRain?1:this.width}px;\n height: ${this.width}px;\n opacity: ${this.opacity};\n background-image: radial-gradient(#fff 0%, rgba(255, 255, 255, 0) 60%);\n border-radius: 50%;\n z-index: 9999999999999;\n pointer-events: none;\n transform: translate(${this.x}px, ${this.y}px) ${this.getRotate(this.sy,this.sx)};\n `
    509. }
    510. render() {
    511. this.el = document.createElement("div"), this.setStyle(), document.body
    512. .appendChild(this.el)
    513. }
    514. move() {
    515. this.isSwing ? ((this.swingRadian > 1.1 || this.swingRadian < .9) && (this
    516. .swingStep = -this.swingStep), this.swingRadian += this
    517. .swingStep, this.isRain ? this.x += this.sx : this.x += this.sx *
    518. Math.sin(this.swingRadian * Math.PI), this.y -= this.sy * Math.cos(
    519. this.swingRadian * Math.PI)) : (this.x += this.sx, this.y +=
    520. this.sy), (this.x < -this.width || this.x > this.windowWidth || this
    521. .y > this.windowHeight) && (this.init(!0), this.setStyle()), this.el
    522. .style.transform =
    523. `translate3d(${this.x}px, ${this.y}px, ${this.z}px) ${this.getRotate(this.sy,this.sx)}`
    524. }
    525. getRotate(i, t) {
    526. return this.isRain ?
    527. `rotate(${0===t?0:90+Math.atan(i/t)*(180/Math.PI)}deg)` : ""
    528. }
    529. }
    530. class n {
    531. constructor(i = {}) {
    532. this.num = i.num || 100, this.opt = i, this.snowList = [], this
    533. .createSnows(), this.moveSnow()
    534. }
    535. createSnows() {
    536. this.snowList = [];
    537. for (let i = 0; i < this.num; i++) {
    538. let i = new h(this.opt);
    539. i.render(), this.snowList.push(i)
    540. }
    541. }
    542. moveSnow() {
    543. window.requestAnimationFrame((() => {
    544. this.snowList.forEach((i => {
    545. i.move()
    546. })), this.moveSnow()
    547. }))
    548. }
    549. }
    550. new n({
    551. isRain: !0,
    552. num: 300,
    553. maxSpeed: 15
    554. }), new n({
    555. isRain: !1,
    556. num: 150
    557. })
    558. }
    559. },
    560. t = {};
    561. function s(h) {
    562. if (t[h]) return t[h].exports;
    563. var n = t[h] = {
    564. exports: {}
    565. };
    566. return i[h](n, n.exports, s), n.exports
    567. }
    568. s.d = (i, t) => {
    569. for (var h in t) s.o(t, h) && !s.o(i, h) && Object.defineProperty(i, h, {
    570. enumerable: !0,
    571. get: t[h]
    572. })
    573. }, s.o = (i, t) => Object.prototype.hasOwnProperty.call(i, t), s(138)
    574. })();
    575. </script>
    576. <!-- 小邱 -->
    577. </body>
    578. </html>