• 【HTML实战】把专属于她的爱心代码放在自己的网站上是一种什么体验?


     一、  写在前面的话

            看多了李洵的炫酷爱心,今天来点不一样的爱心代码。需要李洵的炫酷爱心代码请看我的上一篇文章。

            最近随着电视剧《点燃我温暖你》的火热播出,剧中帅气学霸李洵的炫酷爱心代码也迅速火出了圈,作为一个喜欢动手实践的我来说正是一个大好机会啊,于是我就把代码搬到了自己的网站上,源码我也放在了我的GitHub上,大家有需自取哦~💗

    仓库地址:https://gitee.com/longdebug/web-love-http.git
     

    源码企鹅群号:473193131  或者本人企鹅号:483062431

    后面有时间的话我会将各式各样的爱心代码更新在这个仓库里和群里,如果大家感兴趣的话就来和我一起创造爱心吧~😍

    二、不一样的爱心

    (1)爱心PPT

                   纯前端项目,Html+js照片和音乐这些都可以自行更改。先来看效果图,一张图片一张图片的播放,整体是一个爱心。如果要更改对应文字改对应图片即可。

    1、效果图

    整体效果

    单张图片效果

    2、来吧,代码展示

    主要代码:

    1. <html>HTML>
    2. <html>
    3. <head>
    4. <meta http-equiv='Pragma' content='no-cache' />
    5. <meta charset="UTF-8">
    6. <meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
    7. <meta name="author" content="DSX,工科男表白,浪漫表白,表白网站">
    8. <meta name="description" content="这是XXX为XXX表白制作的表白网站">
    9. <title>XXX LOVE XXXtitle>
    10. <link rel="stylesheet" href="all.min.css" >
    11. head>
    12. <body>
    13. <div class="flowtime">
    14. <div class="ft-section section-1" data-id="section-1">
    15. <div id="/section-1/page-1" class="ft-page page-1" data-id="page-1">
    16. <p class="text1"><span id="text-75" contenteditable="true">XXspan> ❤ <span id="text-76" contenteditable="true">XXspan> <span id="text-77" contenteditable="true">一生一世span>p>
    17. <p class="text2">按键盘 "↓" <span id="text-78" contenteditable="true">开始倾听工科男的浪漫表白span>p>
    18. div>
    19. <div id="/section-1/page-2" class="ft-page page-2" data-id="page-2">
    20. <p class="top-text" id="text-1" contenteditable="true">过去的XX一直是一个人生活,享受着孤独,也憧憬着爱情。p>
    21. <img src="img/iali63.jpg" tppabs="img/iali63.jpg" alt="过去的XX一直是一个人生活,享受着孤独,也憧憬着爱情。" />
    22. div>
    23. <div id="/section-1/page-3" class="ft-page page-3 left-img" data-id="page-3">
    24. <h2 class="text" id="text-2" contenteditable="true">一个人的长廊h2>
    25. <img src="img/iali35.jpg" tppabs="img/iali35.jpg" alt="一个人的长廊"/>
    26. div>
    27. <div id="/section-1/page-4" class="ft-page page-4 full-img" data-id="page-4">
    28. <h2 class="center-text" id="text-3" contenteditable="true">一个人的山岗h2>
    29. <img src="img/iali6.jpg" tppabs="img/iali6.jpg" alt="一个人的山岗" />
    30. div>
    31. div>
    32. <div class="ft-section section-2" data-id="section-2">
    33. <div id="/section-2/page-1" class="ft-page page-5 full-img" data-id="page-1">
    34. <h2 class="center-text" id="text-4" contenteditable="true">一个人的地铁h2>
    35. <img src="img/iali19.jpg" tppabs="img/iali19.jpg" alt="一个人的地铁" />
    36. div>
    37. <div id="/section-2/page-2" class="ft-page page-6" data-id="page-2">
    38. <h2 class="center-text" id="text-5" contenteditable="true">一个人的游乐场h2>
    39. <img src="img/iali29.jpg" tppabs="img/iali29.jpg" alt="一个人的游乐场"/>
    40. div>
    41. <div id="/section-2/page-3" class="ft-page page-7" data-id="page-3">
    42. <h3 id="text-6" contenteditable="true">但他依然乐观,微笑着,等待着h3>
    43. <img src="img/iali60.jpg" tppabs="img/iali60.jpg" alt="但他依然乐观,微笑着,等待着"/>
    44. div>
    45. <div id="/section-2/page-4" class="ft-page page-8 full-img" data-id="page-4">
    46. <h3 id="text-7" contenteditable="true">生活难免有风风雨雨h3>
    47. <img src="img/iali51.jpg" tppabs="img/iali51.jpg" alt="生活难免有风风雨雨" />
    48. div>
    49. <div id="/section-2/page-5" class="ft-page page-9" data-id="page-5">
    50. <h3 id="text-8" contenteditable="true">他总是能够轻松的应对h3>
    51. <img src="img/iali5.jpg" tppabs="img/iali5.jpg" />
    52. div>
    53. <div id="/section-2/page-6" class="ft-page page-10" data-id="page-6">
    54. <h3 id="text-9" contenteditable="true">并且面带阳光、自信的笑容h3>
    55. <img src="img/iali22.jpg" tppabs="img/iali22.jpg" />
    56. div>
    57. div>
    58. <div class="ft-section section-3" data-id="section-3">
    59. <div id="/section-3/page-1" class="ft-page page-11 full-img" data-id="page-1">
    60. <h3 id="text-10" contenteditable="true">生活也不会总是一帆风顺h3>
    61. <img src="img/iali24.jpg" tppabs="img/iali24.jpg" />
    62. div>
    63. <div id="/section-3/page-2" class="ft-page page-12" data-id="page-2">
    64. <h3><span id="text-11" contenteditable="true">但他每次都能勇敢的面对span><br /><span id="text-12" contenteditable="true">随时准备接受生活的挑战span>h3>
    65. <img src="img/iali25.jpg" tppabs="img/iali25.jpg" />
    66. div>
    67. <div id="/section-3/page-3" class="ft-page page-13" data-id="page-3">
    68. <img src="img/iali64.jpg" tppabs="img/iali64.jpg" alt='可是小明的爱情又在哪里呢?' />
    69. <h3 id="text-13" contenteditable="true">可是XX的爱情又在哪里呢?h3>
    70. div>
    71. <div id="/section-3/page-4" class="ft-page page-14 left-img" data-id="page-4">
    72. <h3 id="text-14" contenteditable="true">在镜子里面吗?他不敢相信h3>
    73. <img src="img/iali46.jpg" tppabs="img/iali46.jpg" />
    74. div>
    75. <div id="/section-3/page-5" class="ft-page page-15 left-img" data-id="page-5">
    76. <h3><span id="text-15" contenteditable="true">他去问大树,我的爱情在哪里?span><br /><span id="text-16" contenteditable="true">大树告诉他,也许就在不远的地方span>h3>
    77. <img src="img/iali45.jpg" tppabs="img/iali45.jpg" />
    78. div>
    79. <div id="/section-3/page-6" class="ft-page page-16 left-img" data-id="page-6">
    80. <h3><span id="text-17" contenteditable="true">于是,XX一个人继续向前走span><br /><span id="text-18" contenteditable="true">走在茫茫的雪地上span>h3>
    81. <img src="img/iali66.jpg" tppabs="img/iali66.jpg" />
    82. div>
    83. <div id="/section-3/page-7" class="ft-page page-17 top-text" data-id="page-7">
    84. <h3 id="text-19" contenteditable="true">直到有一天XX与XX相遇了h3>
    85. <img src="img/iali16.jpg" tppabs="img/iali16.jpg" />
    86. div>
    87. div>
    88. <div class="ft-section section-4" data-id="section-4">
    89. <div id="/section-4/page-1" class="ft-page page-18 full-img" data-id="page-1">
    90. <p class="text" id="text-20" contenteditable="true">XX喜欢XX,非常非常的喜欢,因为XX的出现,XX脸上有了更加灿烂的笑容p>
    91. <img src="img/iali11.jpg" tppabs="img/iali11.jpg" />
    92. div>
    93. <div id="/section-4/page-2" class="ft-page page-19" data-id="page-2">
    94. <h3 id="text-21" contenteditable="true">可是XX会喜欢XX吗?h3>
    95. <img src="img/iali75.jpg" tppabs="img/iali75.jpg" />
    96. div>
    97. <div id="/section-4/page-3" class="ft-page page-20" data-id="page-3">
    98. <img src="img/iali59.png" tppabs="img/iali59.png" />
    99. <h3 id="text-22" contenteditable="true">XX想。。。h3>
    100. <img src="img/iali9.jpg" tppabs="img/iali9.jpg" />
    101. div>
    102. <div id="/section-4/page-4" class="ft-page page-21" data-id="page-4">
    103. <h3 id="text-23" contenteditable="true">XX想和XX在一起h3>
    104. <img src="img/iali59.png" tppabs="img/iali59.png" />
    105. div>
    106. <div id="/section-4/page-5" class="ft-page page-22 left-img" data-id="page-5">
    107. <h3 id="text-24" contenteditable="true">然后XX会经常去找XXh3>
    108. <img src="img/iali4.jpg" tppabs="img/iali4.jpg" />
    109. div>
    110. <div id="/section-4/page-6" class="ft-page page-23 left-img" data-id="page-6">
    111. <h3 id="text-25" contenteditable="true">然后两个人一起出去玩h3>
    112. <img src="img/iali44.jpg" tppabs="img/iali44.jpg" />
    113. div>
    114. <div id="/section-4/page-7" class="ft-page page-24 full-img" data-id="page-7">
    115. <h3 id="text-26" contenteditable="true">晚上XX会把XX送回家h3>
    116. <img src="img/iali32.jpg" tppabs="img/iali32.jpg" />
    117. div>
    118. div>
    119. <div class="ft-section section-5" data-id="section-5">
    120. <div id="/section-5/page-1" class="ft-page page-25 left-img" data-id="page-1">
    121. <h3><span id="text-27" contenteditable="true">直到很晚span><br /><span id="text-28" contenteditable="true">XX再一个人回家span>h3>
    122. <img src="img/iali37.jpg" tppabs="img/iali37.jpg" />
    123. div>
    124. <div id="/section-5/page-2" class="ft-page page-26 top-text" data-id="page-2">
    125. <h3 id="text-29" contenteditable="true">然后高兴地进入梦乡,在梦中还会和XX在一起h3>
    126. <img src="img/iali10.gif" tppabs="img/iali10.gif" />
    127. div>
    128. <div id="/section-5/page-3" class="ft-page page-27" data-id="page-3">
    129. <h3 id="text-30" contenteditable="true">XX想成为了XX的逛街助手h3>
    130. <img src="img/iali67.jpg" tppabs="img/iali67.jpg" />
    131. div>
    132. <div id="/section-5/page-4" class="ft-page page-28" data-id="page-4">
    133. <h3 id="text-31" contenteditable="true">然后,XX和XX一起去很多地方玩h3>
    134. <img src="img/iali40.jpg" tppabs="img/iali40.jpg" />
    135. div>
    136. <div id="/section-5/page-5" class="ft-page page-29" data-id="page-5">
    137. <h3 id="text-32" contenteditable="true">XX也想和XX一块成为一对吃货h3>
    138. <img src="img/iali12.jpg" tppabs="img/iali12.jpg" />
    139. div>
    140. <div id="/section-5/page-6" class="ft-page page-30" data-id="page-6">
    141. <h3 id="text-33" contenteditable="true">再然后,他们会搬到了一起h3>
    142. <img src="img/iali76.gif" tppabs="img/iali76.gif" />
    143. div>
    144. <div id="/section-5/page-7" class="ft-page page-31" data-id="page-7">
    145. <h3 id="text-34" contenteditable="true">再然后,XX会开始学习她的技能h3>
    146. <img src="img/iali77.jpg" tppabs="img/iali77.jpg" />
    147. div>
    148. div>
    149. <div class="ft-section section-6" data-id="section-6">
    150. <div id="/section-6/page-1" class="ft-page page-32" data-id="page-1">
    151. <h3 id="text-35" contenteditable="true">煮饭h3>
    152. <img src="img/iali62.jpg" tppabs="img/iali62.jpg" />
    153. div>
    154. <div id="/section-6/page-2" class="ft-page page-33 top-text" data-id="page-2">
    155. <h3 id="text-36" contenteditable="true">那时候,每天早上,他们吃着自己做的美食h3>
    156. <img src="img/iali3.jpg" tppabs="img/iali3.jpg" />
    157. div>
    158. <div id="/section-6/page-3" class="ft-page page-34 left-img" data-id="page-3">
    159. <h3 id="text-37" contenteditable="true">然后在同一个站台,高高兴兴的一起上班h3>
    160. div>
    161. <div id="/section-6/page-4" class="ft-page page-35" data-id="page-4">
    162. <h3><span id="text-38" contenteditable="true">XX会感觉自己好幸福。span><br /><span id="text-39" contenteditable="true">因为自己有了家span><br /><span id="text-40" contenteditable="true">那个有XX在的地方span>h3>
    163. <img src="img/iali8.gif" tppabs="img/iali8.gif" />
    164. div>
    165. <div id="/section-6/page-5" class="ft-page page-36 full-img" data-id="page-5">
    166. <h3 id="text-41" contenteditable="true">他们可能偶尔也会吵架h3>
    167. <img src="img/iali31.jpg" tppabs="img/iali31.jpg" />
    168. div>
    169. <div id="/section-6/page-6" class="ft-page page-37 left-img" data-id="page-6">
    170. <h3 id="text-42" contenteditable="true">XX不想这样h3>
    171. <img src="img/iali49.jpg" tppabs="img/iali49.jpg" />
    172. div>
    173. <div id="/section-6/page-7" class="ft-page page-38 bottom-text" data-id="page-7">
    174. <img src="img/iali21.jpg" tppabs="img/iali21.jpg" />
    175. <h3 id="text-43" contenteditable="true">一定是我有什么做的不对,XX会这么想h3>
    176. div>
    177. div>
    178. <div class="ft-section section-7" data-id="section-7">
    179. <div id="/section-7/page-1" class="ft-page page-39 left-img" data-id="page-1">
    180. <h3 id="text-44" contenteditable="true">如果没有XX在身边,窗外就没有风景h3>
    181. <img src="img/iali2.jpg" tppabs="img/iali2.jpg" />
    182. div>
    183. <div id="/section-7/page-2" class="ft-page page-40" data-id="page-2">
    184. <h3 id="text-45" contenteditable="true">如果没有XX在身后h3>
    185. <img src="img/iali14.jpg" tppabs="img/iali14.jpg" />
    186. div>
    187. <div id="/section-7/page-3" class="ft-page page-41" data-id="page-3">
    188. <img src="img/iali30_1.jpg" tppabs="img/iali30_1.jpg" class='img1'/>
    189. <img src="img/iali30_2.jpg" tppabs="img/iali30_2.jpg" class='img2'/>
    190. <h3 id="text-46" contenteditable="true"> XX又怎会飞的更高更远h3>
    191. div>
    192. <div id="/section-7/page-4" class="ft-page page-42" data-id="page-4">
    193. <h3><span id="text-47" contenteditable="true">XX不想这样。他要为XX改变自己span><br /><span id="text-48" contenteditable="true">XX不知道XX喜欢什么,但他一定会满足她的一切。span>h3>
    194. <img src="img/iali69.jpg" tppabs="img/iali69.jpg" />
    195. div>
    196. <div id="/section-7/page-5" class="ft-page page-43" data-id="page-5">
    197. <img src="img/iali42.jpg" tppabs="img/iali42.jpg" />
    198. <h3 id="text-49" contenteditable="true">我愿意一直陪伴着你h3>
    199. div>
    200. <div id="/section-7/page-6" class="ft-page page-44 left-img" data-id="page-6">
    201. <h3><span id="text-50" contenteditable="true">爱情就像花草一样span><br /><span id="text-51" contenteditable="true">需要用包容来浇灌span>h3>
    202. <img src="img/iali0.jpg" tppabs="img/iali0.jpg" />
    203. div>
    204. <div id="/section-7/page-7" class="ft-page page-45 left-img" data-id="page-7">
    205. <h3><span id="text-52" contenteditable="true">直到一天,XX不想让自己后悔span><br /><span id="text-53" contenteditable="true">XX开始准备一份惊喜span>h3>
    206. <img src="img/iali18.jpg" tppabs="img/iali18.jpg" />
    207. div>
    208. div>
    209. <div class="ft-section section-8" data-id="section-8">
    210. <div id="/section-8/page-1" class="ft-page page-46" data-id="page-1">
    211. <img src="img/iali57.gif" tppabs="img/iali57.gif" />
    212. <h3>
    213. <span id="text-54" contenteditable="true">看着惊喜一点点准备好了span>
    214. <span id="text-55" contenteditable="true">XX好开心span>
    215. <span id="text-56" contenteditable="true">因为他想象着XX看到时span>
    216. <span id="text-57" contenteditable="true">开心的样子span>
    217. h3>
    218. div>
    219. <div id="/section-8/page-2" class="ft-page page-47 top-text" data-id="page-2">
    220. <img src="img/iali58.jpg" tppabs="img/iali58.jpg" />
    221. <h3>
    222. <span id="text-58" contenteditable="true">想想未来他们或许span>
    223. <span id="text-59" contenteditable="true">会有一辈子span>
    224. <span id="text-59" contenteditable="true">XX好开心span>
    225. <span id="text-60" contenteditable="true">或许他可以和XX一起span>
    226. <span id="text-61" contenteditable="true">去全世界好多地方玩span>h3>
    227. div>
    228. <div id="/section-8/page-3" class="ft-page page-48 left-img" data-id="page-3">
    229. <p><span id="text-62" contenteditable="true">XX也会继续努力span><br /><span id="text-63" contenteditable="true">为了他和XX的梦之城堡span>p>
    230. <img src="img/iali65.jpg" tppabs="img/iali65.jpg" />
    231. div>
    232. <div id="/section-8/page-4" class="ft-page page-49 full-img" data-id="page-4">
    233. <img src="img/iali71.jpg" tppabs="img/iali71.jpg" />
    234. <p class="text">
    235. <span class='text' id="text-64" contenteditable="true">XX很幸福,因为他遇到了XX。他相信后面的每天都会是快乐的span><br />
    236. <span class='text' id="text-65" contenteditable="true">简简单单,体会与XX在一起的每一个刻span>
    237. p>
    238. div>
    239. <div id="/section-8/page-5" class="ft-page page-50" data-id="page-5">
    240. <p class='text' id="text-66" contenteditable="true">XX想和XX一起过幸福的生活p>
    241. <img src="img/iali50_1.jpg" tppabs="img/iali50_1.jpg" class='img1' />
    242. <img src="img/iali50_2.jpg" tppabs="img/iali50_2.jpg" class='img2' />
    243. div>
    244. <div id="/section-8/page-6" class="ft-page page-51" data-id="page-6">
    245. <p>
    246. <span id="text-67" contenteditable="true">永远有多远?span><br />
    247. <span id="text-68" contenteditable="true">比时间多一秒就是永远,我会永远爱你span><br />
    248. <span id="text-69" contenteditable="true">世界有多大?span><br />
    249. <span id="text-70" contenteditable="true">你走到哪里,世界就有多大span>
    250. p>
    251. div>
    252. div>
    253. <div class="ft-section section-9" data-id="section-9">
    254. <div id="/section-9/page-1" class="ft-page page-52 full-img" data-id="page-1">
    255. <h3 id="text-71" contenteditable="true">如果三年后你注定是我女朋友,你何不提早行使你的权利h3>
    256. <img src="img/iali20.jpg" tppabs="img/iali20.jpg" />
    257. div>
    258. <div id="/section-9/page-2" class="ft-page page-53" data-id="page-2">
    259. <img src="img/iali68.jpg" tppabs="img/iali68.jpg" alt='happy birthday' />
    260. <h3 id="text-72" contenteditable="true">我爱你h3>
    261. div>
    262. <div id="/section-9/page-3" class="ft-page page-54 center-img" data-id="page-3" >
    263. <div class="center-img">I love youdiv>
    264. div>
    265. <div id="/section-9/page-4" class="ft-page page-55 right-img" data-id="page-4">
    266. <img src="img/14915.jpg" tppabs="img/14915.jpg" />
    267. <p class="text">
    268. <span id="text-73" contenteditable="true">我相信,XX和XX的故事会一直继续下去。span><br />
    269. <span id="text-74" contenteditable="true">无论精彩、平淡都会是他们喜欢的。span><br />
    270. <span id="text-74" contenteditable="true">XXX,我爱你span><br />
    271. <br />
    272. <br />
    273. <span> -- 按“Esc"键有惊喜span>
    274. p>
    275. div>
    276. div>
    277. div>
    278. <div class="nojavascript">您的浏览器禁用了javascript,无法正常浏览本页面div>
    279. <audio id="bgmMusic" src="lovebgm.mp3" autoplay="autoplay" loop preload="auto" type="audio/mp3">audio>
    280. <script src="jquery.min.js" tppabs="http://libs.baidu.com/jquery/1.8.3/jquery.min.js">script>
    281. <script src="all.min.js" >script>
    282. <script src="love.min.js" >script>
    283. <div class="mPower"><span id="on" title="点击暂停" style="">span><span id="off" title="点击播放" style="">span>div>
    284. body>
    285. html>

     整体文件夹:

    需要下载文件的请加群下载或者文章开头提到的下载仓库。

    (2)简单跳动爱心

            看了上一个比较难的爱心,这下来一个简单的爱心教程吧,直接一个文件搞定。

    1、老规矩先看效果。

    开玩笑的这不是真的。来了来了,它来了。

    2、代码展示

    1. html>
    2. <html lang="en">
    3. <head>
    4. <meta charset="UTF-8">
    5. <title>小龙同学title>
    6. <meta name="language" content="zh-CN">
    7. <link rel="icon" type="image/x-icon" href="https://cdn.jsdelivr.net/gh/sun0225SUN/photos/img/20210715233345.png">
    8. <style>
    9. * {
    10. padding: 0;
    11. margin: 0;
    12. }
    13. body {
    14. background-color: pink;
    15. }
    16. #frame {
    17. position: relative;
    18. width: 400px;
    19. height: 300px;
    20. margin: 250px auto;
    21. }
    22. .left,
    23. .right {
    24. top: 0;
    25. width: 200px;
    26. height: 200px;
    27. border-radius: 50%;
    28. }
    29. .left {
    30. left: 35px;
    31. }
    32. .right {
    33. right: 35px;
    34. z-index: -1;
    35. }
    36. .bottom {
    37. bottom: 36px;
    38. left: 100px;
    39. width: 200px;
    40. height: 200px;
    41. transform: rotate(45deg);
    42. z-index: -1;
    43. }
    44. .heart {
    45. position: absolute;
    46. box-shadow: 0 0 40px #d5093c;
    47. animation: beat .4s ease infinite normal;
    48. background: linear-gradient(-90deg, #F50A45 0%, #d5093c 40%);
    49. }
    50. @keyframes beat {
    51. 0% {
    52. transform: scale(1) rotate(225deg);
    53. box-shadow: 0 0 40px #d5093c;
    54. }
    55. 50% {
    56. transform: scale(1.1) rotate(225deg);
    57. box-shadow: 0 0 70px #d5093c;
    58. }
    59. 100% {
    60. transform: scale(1) rotate(225deg);
    61. box-shadow: 0 0 40px #d5093c;
    62. ;
    63. }
    64. }
    65. .word {
    66. position: absolute;
    67. width: 50%;
    68. top: 75%;
    69. left: 25%;
    70. text-align: center;
    71. transform: translateY(-50%);
    72. font-family: 'Love Ya Like A Sister', cursive;
    73. font-size: 40px;
    74. color: #c70012;
    75. padding: 0 20px;
    76. }
    77. style>
    78. head>
    79. <body>
    80. <div id="frame">
    81. <div class="heart left">div>
    82. <div class="heart right">div>
    83. <div class="heart bottom">div>
    84. div>
    85. <b class="word">每次遇见你都心跳加速!b>
    86. <audio autoplay="autopaly" loop="loop" id="audios" preload="auto">
    87. <source src="http://music.163.com/song/media/outer/url?id=526464145.mp3" />
    88. audio>
    89. <script>
    90. var b = document.body;
    91. var c = document.getElementsByTagName('canvas')[0];
    92. var a = c.getContext('2d');
    93. document.body.clientWidth;
    94. with (m = Math) C = cos, S = sin, P = pow, R = random; c.width = c.height = f = 600; h = -250; function p(a, b, c) { if (c > 60) return [S(a * 7) * (13 + 5 / (.2 + P(b * 4, 4))) - S(b) * 50, b * f + 50, 625 + C(a * 7) * (13 + 5 / (.2 + P(b * 4, 4))) + b * 400, a * 1 - b / 2, a]; A = a * 2 - 1; B = b * 2 - 1; if (A * A + B * B < 1) { if (c > 37) { n = (j = c & 1) ? 6 : 4; o = .5 / (a + .01) + C(b * 125) * 3 - a * 300; w = b * h; return [o * C(n) + w * S(n) + j * 610 - 390, o * S(n) - w * C(n) + 550 - j * 350, 1180 + C(B + A) * 99 - j * 300, .4 - a * .1 + P(1 - B * B, -h * 6) * .15 - a * b * .4 + C(a + b) / 5 + P(C((o * (a + 1) + (B > 0 ? w : -w)) / 25), 30) * .1 * (1 - B * B), o / 1e3 + .7 - o * w * 3e-6] } if (c > 32) { c = c * 1.16 - .15; o = a * 45 - 20; w = b * b * h; z = o * S(c) + w * C(c) + 620; return [o * C(c) - w * S(c), 28 + C(B * .5) * 99 - b * b * b * 60 - z / 2 - h, z, (b * b * .3 + P((1 - (A * A)), 7) * .15 + .3) * b, b * .7] } o = A * (2 - b) * (80 - c * 2); w = 99 - C(A) * 120 - C(b) * (-h - c * 4.9) + C(P(1 - b, 7)) * 50 + c * 2; z = o * S(c) + w * C(c) + 700; return [o * C(c) - w * S(c), B * 99 - C(P(b, 7)) * 50 - c / 3 - z / 1.35 + 450, z, (1 - b / 1.2) * .9 + a * .1, P((1 - b), 20) / 4 + .05] } } setInterval('for(i=0;i<1e4;i++)if(s=p(R(),R(),i%46/.74)){z=s[2];x=~~(s[0]*f/z-h);y=~~(s[1]*f/z-h);if(!m[q=y*f+x]|m[q]>z)m[q]=z,a.fillStyle="rgb("+~(s[3]*h)+","+~(s[4]*h)+","+~(s[3]*s[3]*-80)+")",a.fillRect(x,y,1,1)}', 0)
    95. script>
    96. body>
    97. html>

    需要文件也可以到群文件下载。

    (3)收缩的专属爱心

           

    爱心千千万,还不如一颗专属爱心。

    1、效果演示

    2、代码展示

    1. html>
    2. <html>
    3. <head>
    4. <meta charset="utf-8">
    5. <title>送给哩哩title>
    6. <style>
    7. canvas {
    8. position: absolute;
    9. left: 0;
    10. top: 0;
    11. width: 100%;
    12. height: 100%;
    13. background-color: rgba(0, 0, 0, .2);
    14. }
    15. #child{
    16. position: fixed;
    17. top:55%;
    18. left: 50%;
    19. margin-top: -55px;
    20. margin-left:-100px ;
    21. }
    22. h4{font-family:"黑体";font-size: 40px;color:#f47920;position: relative;top: -70px;left: -80px;}
    23. style>
    24. head>
    25. <body>
    26. <canvas id="heart">canvas>
    27. <script>
    28. window.requestAnimationFrame =
    29. window.__requestAnimationFrame ||
    30. window.requestAnimationFrame ||
    31. window.webkitRequestAnimationFrame ||
    32. window.mozRequestAnimationFrame ||
    33. window.oRequestAnimationFrame ||
    34. window.msRequestAnimationFrame ||
    35. (function () {
    36. return function (callback, element) {
    37. var lastTime = element.__lastTime;
    38. if (lastTime === undefined) {
    39. lastTime = 0;
    40. }
    41. var currTime = Date.now();
    42. var timeToCall = Math.max(1, 33 - (currTime - lastTime));
    43. window.setTimeout(callback, timeToCall);
    44. element.__lastTime = currTime + timeToCall;
    45. };
    46. })();
    47. window.isDevice = (/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(((navigator.userAgent || navigator.vendor || window.opera)).toLowerCase()));
    48. var loaded = false;
    49. var init = function () {
    50. if (loaded) return;
    51. loaded = true;
    52. var mobile = window.isDevice;
    53. var koef = mobile ? 0.5 : 1;
    54. var canvas = document.getElementById('heart');
    55. var ctx = canvas.getContext('2d');
    56. var width = canvas.width = koef * innerWidth;
    57. var height = canvas.height = koef * innerHeight;
    58. var rand = Math.random;
    59. ctx.fillStyle = "rgba(0,0,0,1)";
    60. ctx.fillRect(0, 0, width, height);
    61. var heartPosition = function (rad) {
    62. //return [Math.sin(rad), Math.cos(rad)];
    63. return [Math.pow(Math.sin(rad), 3), -(15 * Math.cos(rad) - 5 * Math.cos(2 * rad) - 2 * Math.cos(3 * rad) - Math.cos(4 * rad))];
    64. };
    65. var scaleAndTranslate = function (pos, sx, sy, dx, dy) {
    66. return [dx + pos[0] * sx, dy + pos[1] * sy];
    67. };
    68. window.addEventListener('resize', function () {
    69. width = canvas.width = koef * innerWidth;
    70. height = canvas.height = koef * innerHeight;
    71. ctx.fillStyle = "rgba(0,0,0,1)";
    72. ctx.fillRect(0, 0, width, height);
    73. });
    74. var traceCount = mobile ? 20 : 50;
    75. var pointsOrigin = [];
    76. var i;
    77. var dr = mobile ? 0.3 : 0.1;
    78. for (i = 0; i < Math.PI * 2; i += dr) pointsOrigin.push(scaleAndTranslate(heartPosition(i), 210, 13, 0, 0));
    79. for (i = 0; i < Math.PI * 2; i += dr) pointsOrigin.push(scaleAndTranslate(heartPosition(i), 150, 9, 0, 0));
    80. for (i = 0; i < Math.PI * 2; i += dr) pointsOrigin.push(scaleAndTranslate(heartPosition(i), 90, 5, 0, 0));
    81. var heartPointsCount = pointsOrigin.length;
    82. var targetPoints = [];
    83. var pulse = function (kx, ky) {
    84. for (i = 0; i < pointsOrigin.length; i++) {
    85. targetPoints[i] = [];
    86. targetPoints[i][0] = kx * pointsOrigin[i][0] + width / 2;
    87. targetPoints[i][1] = ky * pointsOrigin[i][1] + height / 2;
    88. }
    89. };
    90. var e = [];
    91. for (i = 0; i < heartPointsCount; i++) {
    92. var x = rand() * width;
    93. var y = rand() * height;
    94. e[i] = {
    95. vx: 0,
    96. vy: 0,
    97. R: 2,
    98. speed: rand() + 5,
    99. q: ~~(rand() * heartPointsCount),
    100. D: 2 * (i % 2) - 1,
    101. force: 0.2 * rand() + 0.7,
    102. f: "hsla(0," + ~~(40 * rand() + 60) + "%," + ~~(60 * rand() + 20) + "%,.3)",
    103. trace: []
    104. };
    105. for (var k = 0; k < traceCount; k++) e[i].trace[k] = {x: x, y: y};
    106. }
    107. var config = {
    108. traceK: 0.4,
    109. timeDelta: 0.01
    110. };
    111. var time = 0;
    112. var loop = function () {
    113. var n = -Math.cos(time);
    114. pulse((1 + n) * .5, (1 + n) * .5);
    115. time += ((Math.sin(time)) < 0 ? 9 : (n > 0.8) ? .2 : 1) * config.timeDelta;
    116. ctx.fillStyle = "rgba(0,0,0,.1)";
    117. ctx.fillRect(0, 0, width, height);
    118. for (i = e.length; i--;) {
    119. var u = e[i];
    120. var q = targetPoints[u.q];
    121. var dx = u.trace[0].x - q[0];
    122. var dy = u.trace[0].y - q[1];
    123. var length = Math.sqrt(dx * dx + dy * dy);
    124. if (10 > length) {
    125. if (0.95 < rand()) {
    126. u.q = ~~(rand() * heartPointsCount);
    127. } else {
    128. if (0.99 < rand()) {
    129. u.D *= -1;
    130. }
    131. u.q += u.D;
    132. u.q %= heartPointsCount;
    133. if (0 > u.q) {
    134. u.q += heartPointsCount;
    135. }
    136. }
    137. }
    138. u.vx += -dx / length * u.speed;
    139. u.vy += -dy / length * u.speed;
    140. u.trace[0].x += u.vx;
    141. u.trace[0].y += u.vy;
    142. u.vx *= u.force;
    143. u.vy *= u.force;
    144. for (k = 0; k < u.trace.length - 1;) {
    145. var T = u.trace[k];
    146. var N = u.trace[++k];
    147. N.x -= config.traceK * (N.x - T.x);
    148. N.y -= config.traceK * (N.y - T.y);
    149. }
    150. ctx.fillStyle = u.f;
    151. for (k = 0; k < u.trace.length; k++) {
    152. ctx.fillRect(u.trace[k].x, u.trace[k].y, 1, 1);
    153. }
    154. }
    155. ctx.fillStyle = "rgba(255,255,255,1)";
    156. for (i = u.trace.length + 13; i--;) ctx.fillRect(targetPoints[i][0], targetPoints[i][1], 2, 2);
    157. window.requestAnimationFrame(loop, canvas);
    158. };
    159. loop();
    160. };
    161. var s = document.readyState;
    162. if (s === 'complete' || s === 'loaded' || s === 'interactive') init();
    163. else document.addEventListener('DOMContentLoaded', init, false);
    164. script>
    165. <div id="child"><h4>💗送给我的小婷婷h4>div>
    166. body>
    167. html>

    三、写在最后的小福利

            一个三个爱心够了,不能再多了

    第一个比较难,有多个文件相互引用,想实现跨越直接下载群里的文件,修改照片和音乐就可以了,第二个和第三个比较简单,只有一个文件。如果是手机实现第二个和第三可以先创建一个txt文件再把代码复制进去,最后修改后缀名为html就可以了。周周学java

     

  • 相关阅读:
    工业控制系统的安全研究与实践引言
    在VirtualLab Fusion的示例中演示连接场解算器
    我终于体会到了:代码竟然不可以运行,为什么呢?代码竟然可以运行,为什么呢?
    Python使用random模块随机生成ip、端口、字符串
    安全架构设计理论与实践
    webpack5零基础入门-6webpack处理图片资源
    用Vue编写一个简单的仿Explorer文件管理器
    树和二叉树练习题
    ubuntu20单主机安装hadoop,python的简单操作
    python Zipf定律-高度偏斜分布
  • 原文地址:https://blog.csdn.net/lonzgzhouzhou/article/details/127830200