当前位置:   article > 正文

HTML超级浪漫的独一无二的爱心表白代码,亲测可用!_爱心表白代码html大全

爱心表白代码html大全

话不多说代码给上,感觉不错还请一键三联!

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <link rel="icon" type="image/x-icon" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAA2klEQVQ4T62TUQ6CMAyG2/GCByAeR7iSxmfgmahHch7HcAB5YSXb2GBlmCW6t6Xtt7/tP4QfD7r6Pu9KwKx29+Jzrtbs/nB/xmIGYIr1wcwnAY0BIBYrhqucAY8akBrejSJqBQjaix2HS4MraVZFeOR83Y05QCwhZbzyD4C8KxWIUiD6DaQ8beej7BDf+a0RiCcASG1FKqKXGSLzwbLGbzJorPQKzeYDAPdCDDL7YwPwhlrcyNuxK6WxdcWBgohtNwBu730AtzaTvX7Mz4C3G3wuJjsJkOIFnTMBCHFmkktRl00AAAAASUVORK5CYII=" />
  6. <title>code</title>
  7. <style>
  8. * {
  9. margin: 0;
  10. padding: 0;
  11. }
  12. body {
  13. background-color: #000;
  14. overflow: hidden;
  15. min-width: 1600px;
  16. min-height: 900px;
  17. }
  18. .box {
  19. transform: rotate3d(0, 0, 0, 0deg);
  20. transform-origin: 926px 576px;
  21. transition: transform 5s;
  22. transform-style: preserve-3d;
  23. }
  24. .stars {
  25. position: absolute;
  26. top: 50%;
  27. left: 50%;
  28. width: 3px;
  29. height: 3px;
  30. border-radius: 50%;
  31. animation: opacity 3s linear infinite;
  32. }
  33. @keyframes opacity {
  34. 0% {
  35. opacity: .9;
  36. }
  37. 50% {
  38. opacity: .5;
  39. }
  40. 100% {
  41. opacity: .99;
  42. }
  43. }
  44. @keyframes animationColor {
  45. 0% {
  46. background-position: 0 0;
  47. }
  48. 100% {
  49. background-position: -100% 0;
  50. }
  51. }
  52. span {
  53. position: absolute;
  54. left: 100px;
  55. top: 100px;
  56. font-size: 32px;
  57. font-weight: bolder;
  58. font-family: cursive;
  59. color: #ccc;
  60. transition-property: left, top, transform, opacity;
  61. transition-timing-function: ease;
  62. -moz-transition-timing-function: ease;
  63. -webkit-transition-timing-function: ease;
  64. -o-transition-timing-function: ease;
  65. transition-duration: 100ms;
  66. }
  67. @keyframes show_temp_me {
  68. from {
  69. opacity: 0;
  70. }
  71. to {
  72. opacity: 1;
  73. }
  74. }
  75. .heart {
  76. opacity: 0;
  77. position: absolute;
  78. left: 1340px;
  79. top: 546px;
  80. font-size: 100px;
  81. color: #f00;
  82. text-shadow: 2px 2px 2px #f00;
  83. z-index: 999;
  84. transition: opacity 5s;
  85. }
  86. .heartBroken {
  87. filter: blur(0.007em);
  88. }
  89. .heartBroken::before,
  90. .heartBroken::after {
  91. content: "❤";
  92. position: absolute;
  93. top: 0;
  94. left: 0;
  95. transform-origin: 50% 80%;
  96. }
  97. .heartBroken::before {
  98. animation: crack1 2.5s linear 1s forwards;
  99. clip-path: inset(0 50% 0 0);
  100. }
  101. .heartBroken::after {
  102. animation: crack2 1.5s linear 200ms forwards;
  103. clip-path: inset(0 0 0 50%);
  104. }
  105. @keyframes crack1 {
  106. 0% {
  107. transform: rotateZ(0deg);
  108. }
  109. 100% {
  110. transform: rotateZ(-10deg);
  111. }
  112. }
  113. @keyframes crack2 {
  114. 0% {
  115. transform: rotateZ(0deg);
  116. }
  117. 100% {
  118. transform: rotateZ(10deg);
  119. }
  120. }
  121. @keyframes beat {
  122. 0% {
  123. transform: scale(1);
  124. }
  125. 50% {
  126. transform: scale(1.2)
  127. }
  128. 100% {
  129. transform: scale(1)
  130. }
  131. }
  132. .box > div {
  133. position: relative;
  134. transition-property: left, top, opacity;
  135. transition-duration: 3s;
  136. transition-timing-function: ease-out;
  137. }
  138. span {
  139. position: absolute;
  140. left: 100px;
  141. top: 100px;
  142. font-size: 22px;
  143. font-weight: bolder;
  144. font-family: cursive;
  145. color: #ccc;
  146. transition-property: left, top, transform, opacity;
  147. transition-timing-function: ease;
  148. -moz-transition-timing-function: ease;
  149. -webkit-transition-timing-function: ease;
  150. -o-transition-timing-function: ease;
  151. transition-duration: 100ms;
  152. }
  153. .broken {
  154. transform: rotateZ(0deg);
  155. transition-property: transform;
  156. transition-timing-function: ease;
  157. -moz-transition-timing-function: ease;
  158. -webkit-transition-timing-function: ease;
  159. -o-transition-timing-function: ease;
  160. transition-duration: 1s;
  161. }
  162. #love_left {
  163. transform-origin: 870px 780px;
  164. }
  165. #love_right {
  166. transform-origin: 870px 730px;
  167. }
  168. .text_ta {
  169. opacity: 0;
  170. position: relative;
  171. -webkit-background-clip: text;
  172. color: transparent;
  173. font-size: 100px;
  174. transition-property: top, left, opacity;
  175. transition-timing-function: ease;
  176. -moz-transition-timing-function: ease;
  177. -webkit-transition-timing-function: ease;
  178. -o-transition-timing-function: ease;
  179. transition-duration: 2s;
  180. }
  181. .arrow {
  182. width: 222px;
  183. height: 110px;
  184. position: absolute;
  185. top: -300px;
  186. left: 770px;
  187. transform: rotateZ(0deg);
  188. transition-property: top, left, transform;
  189. transition-duration: 1s;
  190. }
  191. .bloods {
  192. position: absolute;
  193. left: 34px;
  194. top: 96px;
  195. width: 32px;
  196. height: 32px;
  197. border-radius: 8px 42px 24px 42px;
  198. background-color: #d30;
  199. transform: rotate(45deg);
  200. transition: top 3s;
  201. }
  202. </style>
  203. </head>
  204. <body>
  205. <div class="stars" id="stars"></div>
  206. <script>
  207. let arr = ['one', 'two', 'three', 'four', 'five', 'six', 'seven']
  208. let love_2 = {
  209. one: [[], []],
  210. two: [[], []],
  211. three: [[], []],
  212. four: [[], []],
  213. five: [[], []],
  214. six: [[], []],
  215. seven: [[], []],
  216. }
  217. let love = {
  218. one: [
  219. [482, 482, 463, 463, 446, 446, 434, 434, 425, 425, 423, 423, 426, 426, 434, 434, 446, 446, 461, 461, 479, 479, 499, 499, 521, 521, 542, 542, 562, 562, 583, 583, 603, 603, 623, 623, 639, 639, 655, 655, 671, 671, 685, 685, 701, 701, 714, 714, 728, 728, 744, 744, 758, 758, 773, 773, 785],
  220. [1366, 1388, 1353, 1401, 1337, 1417, 1318, 1436, 1296, 1458, 1274, 1482, 1252, 1504, 1231, 1526, 1213, 1544, 1198, 1559, 1187, 1568, 1180, 1575, 1177, 1578, 1178, 1577, 1180, 1575, 1184, 1571, 1192, 1563, 1202, 1553, 1215, 1540, 1230, 1525, 1246, 1509, 1262, 1493, 1279, 1476, 1295, 1460, 1312, 1443, 1328, 1427, 1345, 1410, 1361, 1394, 1378]
  221. ],
  222. two: [
  223. [501, 501, 489, 489, 471, 471, 456, 456, 445, 445, 444, 444, 447, 447, 455, 455, 468, 468, 486, 486, 507, 507, 527, 527, 546, 546, 566, 566, 586, 586, 605, 605, 622, 622, 638, 638, 653, 653, 667, 667, 681, 681, 694, 694, 708, 708, 724, 724, 737, 737, 752, 752],
  224. [1366, 1388, 1346, 1408, 1333, 1421, 1317, 1437, 1299, 1455, 1278, 1476, 1257, 1497, 1237, 1517, 1221, 1533, 1208, 1546, 1201, 1553, 1200, 1554, 1200, 1554, 1202, 1552, 1206, 1548, 1215, 1539, 1228, 1526, 1242, 1512, 1258, 1496, 1272, 1482, 1287, 1467, 1304, 1450, 1320, 1434, 1335, 1419, 1352, 1402, 1367, 1388]
  225. ],
  226. three: [
  227. [520, 520, 510, 510, 498, 498, 481, 481, 465, 465, 464, 464, 467, 467, 480, 480, 497, 497, 518, 518, 538, 538, 557, 557, 578, 578, 598, 598, 614, 614, 631, 631, 645, 645, 660, 660, 673, 673, 688, 688, 703, 703, 716, 716, 733],
  228. [1366, 1388, 1346, 1408, 1327, 1427, 1314, 1440, 1299, 1455, 1277, 1477, 1256, 1498, 1239, 1515, 1226, 1528, 1219, 1535, 1220, 1534, 1221, 1533, 1226, 1528, 1235, 1522, 1249, 1508, 1262, 1495, 1278, 1479, 1294, 1463, 1311, 1446, 1326, 1431, 1341, 1416, 1358, 1399, 1378]
  229. ],
  230. four: [
  231. [539, 539, 530, 530, 518, 518, 507, 507, 490, 490, 485, 485, 496, 496, 514, 514, 534, 534, 554, 554, 574, 574, 593, 593, 610, 610, 625, 625, 639, 639, 652, 652, 668, 668, 683, 683, 696, 696, 714],
  232. [1366, 1388, 1346, 1408, 1327, 1427, 1307, 1447, 1294, 1460, 1272, 1482, 1254, 1500, 1241, 1513, 1241, 1513, 1242, 1512, 1247, 1507, 1259, 1495, 1271, 1483, 1286, 1468, 1303, 1451, 1321, 1433, 1335, 1419, 1350, 1404, 1366, 1388, 1379]
  233. ],
  234. five: [
  235. [559, 559, 550, 550, 539, 539, 530, 530, 514, 514, 516, 516, 538, 538, 558, 558, 578, 578, 597, 597, 613, 613, 627, 627, 639, 639, 655, 655, 672, 672],
  236. [1366, 1388, 1344, 1410, 1324, 1430, 1304, 1450, 1286, 1468, 1265, 1489, 1262, 1493, 1263, 1492, 1275, 1480, 1287, 1468, 1304, 1451, 1321, 1434, 1339, 1416, 1352, 1400, 1366, 1387]
  237. ],
  238. six: [
  239. [580, 580, 570, 570, 560, 560, 550, 550, 536, 536, 556, 556, 576, 576, 592, 592, 606, 606, 619, 619, 634, 634, 650],
  240. [1366, 1388, 1345, 1409, 1325, 1429, 1305, 1449, 1284, 1470, 1285, 1469, 1296, 1458, 1312, 1442, 1328, 1426, 1346, 1408, 1361, 1393, 1377]
  241. ],
  242. seven: [
  243. [603, 603, 592, 592, 578, 578, 621],
  244. [1367, 1389, 1346, 1408, 1324, 1428, 1376]
  245. ]
  246. }
  247. function stars() {
  248. let boxShadow = "";
  249. for (let i = 0; i < 2000; i++) {
  250. boxShadow += parseInt(1000 - (Math.random() * 2000)) + "px " + parseInt(1000 - (Math.random() * 2000)) + "px #" + Math.random().toString(16).substr(-6) + ",";
  251. }
  252. boxShadow = boxShadow.replace(/,$/gi, "");
  253. document.getElementById("stars").style.boxShadow = boxShadow;
  254. setTimeout(function () {
  255. stars()
  256. }, 6000)
  257. }
  258. window.onload = function () {
  259. stars()
  260. for (const value of arr) {
  261. for (let i = 0; i < love[value][0].length; i++) {
  262. love_2[value][0][i] = love[value][0][i] - 360
  263. love_2[value][1][i] = love[value][1][i] - 1166
  264. }
  265. }
  266. document.getElementsByTagName('body')[0].innerHTML += '<div id="box" class="box"><div style="opacity:0" class="ta" id="ta"></div><div class="me" id="me"></div></div>'
  267. let object = new Class()
  268. object.start()
  269. }
  270. let arrow = {
  271. top: [0, 16, 38, 62, 80, 38, 38, 38, 38, 38, 38, 38, 38, 38, 0, 14, 62, 80],
  272. left: [0, 15, 31, 15, 0, 50, 69, 88, 107, 126, 145, 164, 183, 202, 171, 189, 189, 171],
  273. rotate: [300, 300, 270, 225, 225, 270, 270, 270, 270, 270, 270, 270, 270, 270, 300, 300, 225, 225]
  274. }
  275. class Class {
  276. async start() {
  277. await this.showTA()
  278. await this.show_me()
  279. await this.discolor_me()
  280. await this.show_ta_one()
  281. await this.change_me_color()
  282. await this.heart()
  283. await this.show_ta_all()
  284. await this.near()
  285. await this.rotate()
  286. await this.separate()
  287. await this.arrow()
  288. await this.heartBroken_()
  289. await this.drippingBlood()
  290. await this.ta_disappear()
  291. await this.broken()
  292. this.end()
  293. }
  294. showTA() {
  295. let that = this
  296. return new Promise(function (resolve) {
  297. let width = document.documentElement.clientWidth
  298. let height = document.documentElement.clientHeight
  299. let backgroundImage = ""
  300. for (let i = 0; i < 10; i++) {
  301. backgroundImage += "#" + Math.random().toString(16).substr(-6) + ","
  302. }
  303. backgroundImage = backgroundImage.replace(/,$/gi, ');"');
  304. let style = '"text-fill-color:transparent;background-clip:text;background-size:200% 100%;left:' + (width / 2 - 50) + 'px;top:' + (height / 2 - 50) + 'px;background-image: linear-gradient(to right,' + backgroundImage
  305. document.getElementsByTagName('body')[0].innerHTML += '<p id="text_ta" class="text_ta" style=' + style + '>我喜欢你,(名字)</p>'
  306. let element = document.getElementById('text_ta')
  307. setTimeout(function () {
  308. element.style.opacity = '1'
  309. },500)
  310. setTimeout(function () {
  311. element.style.top = "180px"
  312. element.style.left = "165px"
  313. element.style.animation = "animationColor 5s infinite linear"
  314. setTimeout(function () {
  315. resolve("showTA")
  316. }, 2500)
  317. }, 2800)
  318. that.text_ta_backgroundImage_interval = setInterval(function () {
  319. let backgroundImage = ""
  320. for (let i = 0; i < 10; i++) {
  321. backgroundImage += "#" + Math.random().toString(16).substr(-6) + ","
  322. }
  323. backgroundImage = backgroundImage.replace(/,$/gi, ')');
  324. element.style.backgroundImage = 'linear-gradient(to right,' + backgroundImage
  325. }, 3000)
  326. })
  327. }
  328. show_me() {
  329. return new Promise(async function (resolve, reject) {
  330. document.getElementById("me").innerHTML += '<div id="love_left" class="broken"></div>'
  331. document.getElementById("me").innerHTML += '<div id="love_right" class="broken"></div>'
  332. let love_left = document.getElementById('love_left')
  333. let love_right = document.getElementById('love_right')
  334. let color = "#858585"
  335. for (const value of arr) {
  336. for (let i = 0; i < love[value][0].length; i++) {
  337. if (i % 2 === 0) {
  338. love_left.innerHTML += "<span id=" + value + "_" + i + " style='opacity:0;color:" + color + ";top:" + love[value][0][i] + "px;left:" + love[value][1][i] + "px;text-shadow:2px 2px 2px " + color + ";'>❤</span>"
  339. } else {
  340. love_right.innerHTML += "<span id=" + value + "_" + i + " style='opacity:0;color:" + color + ";top:" + love[value][0][i] + "px;left:" + love[value][1][i] + "px;text-shadow:2px 2px 2px " + color + ";'>❤</span>"
  341. }
  342. }
  343. }
  344. for (const value of arr) {
  345. for (let i = 0; i < love[value][0].length; i++) {
  346. await new Promise(function (resolve) {
  347. setTimeout(function () {
  348. let element = document.getElementById(value + "_" + i)
  349. element.style.opacity = "1"
  350. resolve()
  351. }, 20)
  352. })
  353. }
  354. }
  355. resolve("show_me")
  356. })
  357. }
  358. discolor_me() {
  359. let interval = '';
  360. let time = 800;
  361. return new Promise(function (resolve) {
  362. interval = setInterval(discolor, time)
  363. function discolor() {
  364. let element = "";
  365. for (const value of arr) {
  366. for (let i = 0; i < love[value][0].length; i++) {
  367. element = document.getElementById(value + "_" + i)
  368. element.style.color = "#" + Math.random().toString(16).substr(-6)
  369. element.style.textShadow = "2px 2px 2px #" + Math.random().toString(16).substr(-6)
  370. }
  371. }
  372. clearInterval(interval);
  373. if (time > 400) {
  374. time -= 80;
  375. } else if (time > 390) {
  376. time -= 1;
  377. resolve("discolor_me")
  378. }
  379. if (time > 390) {
  380. interval = setInterval(discolor, time);
  381. }
  382. }
  383. })
  384. }
  385. show_ta_one() {
  386. let that = this
  387. return new Promise(function (resolve) {
  388. let i = 0;
  389. let text_ta = document.getElementById('text_ta')
  390. text_ta.style.transitionDuration = "4s"
  391. text_ta.style.opacity = "0"
  392. clearInterval(that.text_ta_backgroundImage_interval)
  393. setTimeout(function () {
  394. document.getElementById("text_ta").remove()
  395. }, 5000)
  396. document.getElementById("box").innerHTML += '<div id="temp_ta" class="temp_ta"></div>'
  397. let element = document.getElementById('temp_ta')
  398. let interval = setInterval(function () {
  399. element.innerHTML += "<span id=temp_" + i + " style='z-index:-1;opacity:1;:#858585;top:" + love_2.one[0][i] + "px;left:" + love_2.one[1][i] + "px;text-shadow:2px 2px 2px #858585;'>❤</span>"
  400. i++
  401. if (i === love_2.one[0].length) {
  402. clearInterval(interval)
  403. setTimeout(function () {
  404. resolve("show_ta_one")
  405. }, 500)
  406. }
  407. }, 50)
  408. })
  409. }
  410. change_me_color() {
  411. let that = this
  412. return new Promise(async function (resolve) {
  413. document.getElementById("me").innerHTML += '<div style="opacity:0;" id="temp_me" class="temp_me"></div>'
  414. let element = document.getElementById("temp_me")
  415. for (const value of arr) {
  416. for (let i = 0; i < love[value][0].length; i++) {
  417. element.innerHTML += "<span id=temp_" + value + "_" + i + " style='color:#EB098E;top:" + love[value][0][i] + "px;left:" + love[value][1][i] + "px;text-shadow:2px 2px 2px #FDB0DA;'>❤</span>"
  418. }
  419. }
  420. setTimeout(function () {
  421. element.style.animation = "show_temp_me 5s"
  422. setTimeout(function () {
  423. for (const value of arr) {
  424. for (let i = 0; i < love[value][0].length; i++) {
  425. let element = document.getElementById(value + "_" + i)
  426. element.style.color = "#EB098E"
  427. element.style.textShadow = "2px 2px 2px #FDB0DA"
  428. }
  429. }
  430. setTimeout(function () {
  431. document.getElementById("temp_me").remove()
  432. }, 6000)
  433. }, 4000)
  434. resolve("change_me_color")
  435. }, 500)
  436. })
  437. }
  438. heart() {
  439. return new Promise(function (resolve) {
  440. document.getElementById('me').innerHTML += '<p data-text="❤" id="heart" class="heart">❤</p>'
  441. let heart = document.getElementById("heart")
  442. setTimeout(function () {
  443. heart.style.opacity = "1"
  444. heart.style.zIndex = "3"
  445. }, 20)
  446. setTimeout(function () {
  447. heart.style.animation = "beat 1s linear infinite"
  448. setTimeout(function () {
  449. resolve("heart")
  450. }, 500)
  451. }, 4500)
  452. })
  453. }
  454. show_ta_all() {
  455. return new Promise(function (resolve) {
  456. let element = document.getElementById("ta")
  457. for (const value of arr) {
  458. for (let i = 0; i < love_2[value][0].length; i++) {
  459. element.innerHTML += "<span id=" + value + "_" + i + " style='color:#FDB0DA;top:" + love_2[value][0][i] + "px;left:" + love_2[value][1][i] + "px;text-shadow:2px 2px 2px #EB098E;'>❤</span>"
  460. }
  461. }
  462. setTimeout(function () {
  463. element.style.opacity = "1"
  464. setTimeout(function () {
  465. document.getElementById("temp_ta").remove()
  466. resolve("show_ta_all")
  467. }, 3500)
  468. }, 500)
  469. })
  470. }
  471. near() {
  472. return new Promise(function (resolve) {
  473. let me = document.getElementById("me");
  474. let ta = document.getElementById("ta");
  475. me.style.top = "0";
  476. me.style.left = "0";
  477. ta.style.top = "0";
  478. ta.style.left = "0";
  479. setTimeout(function () {
  480. me.style.top = "-132px";
  481. me.style.left = "-364px";
  482. ta.style.top = "230px";
  483. ta.style.left = "600px";
  484. setTimeout(function () {
  485. resolve("near");
  486. }, 4000)
  487. }, 100)
  488. })
  489. }
  490. rotate() {
  491. return new Promise(function (resolve) {
  492. document.getElementById("box").style.transform = "rotate3d(1,1,1,360deg)";
  493. setTimeout(function () {
  494. resolve("rotate")
  495. }, 6500)
  496. })
  497. }
  498. separate() {
  499. return new Promise(function (resolve) {
  500. let ta = document.getElementById("ta")
  501. ta.style.top = "0"
  502. ta.style.left = "0"
  503. setTimeout(function () {
  504. resolve()
  505. }, 3500)
  506. })
  507. }
  508. arrow() {
  509. return new Promise(function (resolve) {
  510. let me = document.getElementById("me")
  511. me.innerHTML += '<div class="arrow" id="arrow"></div>'
  512. let element = document.getElementById("arrow");
  513. for (let i = 0; i < 18; i++) {
  514. let style = "'z-index:2;color:#fe0;top:" + arrow.top[i] + "px;left:" + arrow.left[i] + "px;transform: rotate(" + arrow.rotate[i] + "deg)'"
  515. element.innerHTML += '<span id="arrow_' + i + '" style=' + style + '>❤</span>'
  516. }
  517. setTimeout(function () {
  518. element.style.top = parseInt(Math.random() * (400 - 100) + 100) + "px";
  519. }, 1000)
  520. setTimeout(function () {
  521. let heart = document.getElementById("heart")
  522. let heart_center_x = Math.floor(heart.getBoundingClientRect().left) + Math.floor(heart.getBoundingClientRect().width / 2)
  523. let heart_center_y = Math.floor(heart.getBoundingClientRect().top) + Math.floor(heart.getBoundingClientRect().height / 2)
  524. let arrow = document.getElementById("arrow")
  525. let rotate = 360 * Math.atan((arrow.getBoundingClientRect().y - heart.getBoundingClientRect().y) / (arrow.getBoundingClientRect().x - heart.getBoundingClientRect().x)) / (2 * Math.PI);
  526. element.style.transform = "rotate(" + rotate + "deg)"
  527. let x = heart_center_x + Math.abs(me.getBoundingClientRect().left) - (arrow.getBoundingClientRect().width / 2)
  528. let y = heart_center_y + Math.abs(me.getBoundingClientRect().top) - (arrow.getBoundingClientRect().height / 2)
  529. setTimeout(function () {
  530. element.style.top = y + 'px'
  531. element.style.left = x + 'px'
  532. setTimeout(function () {
  533. heart.style.animation = ""
  534. resolve()
  535. }, 2000)
  536. }, 2000)
  537. }, 3000)
  538. })
  539. }
  540. heartBroken_() {
  541. return new Promise(function (resolve) {
  542. let element = document.getElementById('heart')
  543. element.classList.add("heartBroken")
  544. setTimeout(function () {
  545. element.innerHTML = ''
  546. element.innerText = ''
  547. setTimeout(function () {
  548. document.getElementById('arrow').style.top = window.screen.height + 200 + "px"
  549. setTimeout(function () {
  550. resolve()
  551. }, 2000)
  552. }, 2000)
  553. }, 800)
  554. })
  555. }
  556. drippingBlood() {
  557. return new Promise(function (resolve) {
  558. let height = document.documentElement.clientHeight + 50
  559. let heart = document.getElementById("heart")
  560. heart.innerHTML += '<div id="blood"></div>'
  561. let blood = document.getElementById('blood')
  562. let i = 1;
  563. let stop = 10;
  564. let intervalID = setInterval(function () {
  565. if (i === 6){
  566. resolve()
  567. }
  568. if (i > stop) {
  569. clearInterval(intervalID)
  570. return
  571. }
  572. blood.innerHTML += "<p id='blood_" + i + "'class='bloods'></p>"
  573. start(i)
  574. i++
  575. }, 1000)
  576. function start(i){
  577. if(i === stop){
  578. setTimeout(function () {
  579. blood.innerHTML = ''
  580. },2100)
  581. }
  582. setTimeout(function () {
  583. document.getElementById("blood_" + i).style.top = height+"px"
  584. }, 50)
  585. }
  586. })
  587. }
  588. ta_disappear(){
  589. return new Promise(function (resolve){
  590. let ta = document.getElementById('ta');
  591. ta.style.top = "-300px"
  592. ta.style.left = "-200px"
  593. ta.style.opacity = '0'
  594. setTimeout(function () {
  595. document.getElementById("heart").style.opacity = '0'
  596. setTimeout(function () {
  597. resolve()
  598. },3500)
  599. },3000)
  600. })
  601. }
  602. broken(){
  603. return new Promise(function (resolve){
  604. let height = window.screen.height * 1.2
  605. let width = window.screen.width * 1.2
  606. let top = "";
  607. let left = "";
  608. let love_left = document.getElementById('love_left').childNodes;
  609. let love_right = document.getElementById('love_right').childNodes
  610. for (let i = 0; i < love_left.length; i++) {
  611. top = parseInt(Math.random() * (height - 1) + 1)
  612. left = parseInt(Math.random() * (width - 1) + 1)
  613. love_left[i].style.transitionDuration = '3s';
  614. love_left[i].style.top = top + "px";
  615. love_left[i].style.left = left + "px";
  616. love_left[i].style.transform = "rotate("+(Math.random() * (360 - 1) + 1)+"deg)"
  617. }
  618. for (let i = 0; i < love_right.length; i++) {
  619. top = parseInt(Math.random() * (height - 1) + 1)
  620. left = parseInt(Math.random() * (width - 1) + 1)
  621. love_right[i].style.transitionDuration = '3s';
  622. love_right[i].style.top = top + "px";
  623. love_right[i].style.left = left + "px";
  624. love_right[i].style.transform = "rotate("+(Math.random() * (360 - 1) + 1)+"deg)"
  625. }
  626. setTimeout(function () {
  627. resolve()
  628. },3500)
  629. })
  630. }
  631. end(){
  632. document.getElementById('me').style.opacity = '0'
  633. setTimeout(function () {
  634. let body = document.getElementsByTagName('body');
  635. body.removeChild(document.getElementById('box'));
  636. },5000)
  637. }
  638. }
  639. </script>
  640. </body>
  641. </html>

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/菜鸟追梦旅行/article/detail/120639?site
推荐阅读
相关标签
  

闽ICP备14008679号