软件系统定制开发Html5+CSS3+JS代码实现圣诞节动态表白特效,祝你成功

一、前言

软件系统定制开发临近平安夜、软件系统定制开发圣诞节的到来,软件系统定制开发又是一波大好表白时机!软件系统定制开发身边的同学马上就要动手了,还不快行动起来,程序员也有属于我们的浪漫!这篇文章使用前端三大技术、CSS、Js来实现圣诞动态表白特效。

二、表白特效演示及源码

1、圣诞表白特效

 圣诞表白特效:仅含有一个HTML文件即可实现,可修改在一起的时间、表白美句等

    html代码:

  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>小Z同学</title><!-- 这是网页标题 -->
  6. <style>
  7. body{
  8. overflow: hidden;
  9. margin: 0;
  10. }
  11. h1{
  12. position: fixed;
  13. top: 50%;
  14. left: 0;
  15. width: 100%;
  16. text-align: center;
  17. transform:translateY(-50%);
  18. font-family: 'Love Ya Like A Sister', cursive;
  19. font-size: 40px;
  20. color: #c70012;
  21. padding: 0 20px;
  22. }
  23. h1 span{
  24. font-size:20px;
  25. }
  26. </style>
  27. </head>
  28. <body>
  29. <h1 id="h1"></h1>
  30. <canvas></canvas> <!--canvas 画布-->
  31. <script>
  32. var canvas = document.querySelector("canvas"),
  33. ctx = canvas.getContext("2d");
  34. var ww,wh;
  35. function onResize(){
  36. ww = canvas.width = window.innerWidth;
  37. wh = canvas.height = window.innerHeight;
  38. }
  39. ctx.strokeStyle = "red";
  40. ctx.shadowBlur = 25;
  41. ctx.shadowColor = "hsla(0, 100%, 60%,0.5)";
  42. var precision = 100;
  43. var hearts = [];
  44. var mouseMoved = false;
  45. function onMove(e){
  46. mouseMoved = true;
  47. if(e.type === "touchmove"){
  48. hearts.push(new Heart(e.touches[0].clientX, e.touches[0].clientY));
  49. hearts.push(new Heart(e.touches[0].clientX, e.touches[0].clientY));
  50. }
  51. else{
  52. hearts.push(new Heart(e.clientX, e.clientY));
  53. hearts.push(new Heart(e.clientX, e.clientY));
  54. }
  55. }
  56. var Heart = function(x,y){
  57. this.x = x || Math.random()*ww;
  58. this.y = y || Math.random()*wh;
  59. this.size = Math.random()*2 + 1;
  60. this.shadowBlur = Math.random() * 10;
  61. this.speedX = (Math.random()+0.2-0.6) * 8;
  62. this.speedY = (Math.random()+0.2-0.6) * 8;
  63. this.speedSize = Math.random()*0.05 + 0.01;
  64. this.opacity = 1;
  65. this.vertices = [];
  66. for (var i = 0; i < precision; i++) {
  67. var step = (i / precision - 0.5) * (Math.PI * 2);
  68. var vector = {
  69. x : (15 * Math.pow(Math.sin(step), 3)),
  70. y : -(13 * Math.cos(step) - 5 * Math.cos(2 * step) - 2 * Math.cos(3 * step) - Math.cos(4 * step))
  71. }
  72. this.vertices.push(vector);
  73. }
  74. }
  75. Heart.prototype.draw = function(){
  76. this.size -= this.speedSize;
  77. this.x += this.speedX;
  78. this.y += this.speedY;
  79. ctx.save();
  80. ctx.translate(-1000,this.y);
  81. ctx.scale(this.size, this.size);
  82. ctx.beginPath();
  83. for (var i = 0; i < precision; i++) {
  84. var vector = this.vertices[i];
  85. ctx.lineTo(vector.x, vector.y);
  86. }
  87. ctx.globalAlpha = this.size;
  88. ctx.shadowBlur = Math.round((3 - this.size) * 10);
  89. ctx.shadowColor = "hsla(0, 100%, 60%,0.5)";
  90. ctx.shadowOffsetX = this.x + 1000;
  91. ctx.globalCompositeOperation = "screen"
  92. ctx.closePath();
  93. ctx.fill()
  94. ctx.restore();
  95. };
  96. function render(a){
  97. requestAnimationFrame(render);
  98. hearts.push(new Heart())
  99. ctx.clearRect(0,0,ww,wh);
  100. for (var i = 0; i < hearts.length; i++) {
  101. hearts[i].draw();
  102. if(hearts[i].size <= 0){
  103. hearts.splice(i,1);
  104. i--;
  105. }
  106. }
  107. }
  108. onResize();
  109. window.addEventListener("mousemove", onMove);
  110. window.addEventListener("touchmove", onMove);
  111. window.addEventListener("resize", onResize);
  112. requestAnimationFrame(render);
  113. window.onload=function starttime(){
  114. time(h1,'2017,7,9'); // 在一起的时间
  115. ptimer = setTimeout(starttime,1000); // 添加计时器
  116. }
  117. function time(obj,futimg){
  118. var nowtime = new Date().getTime(); // 现在时间转换为时间戳
  119. var futruetime = new Date(futimg).getTime(); // 未来时间转换为时间戳
  120. var msec = nowtime-futruetime; // 毫秒 未来时间-现在时间
  121. var time = (msec/1000); // 毫秒/1000
  122. var day = parseInt(time/86400); // 天 24*60*60*1000
  123. var hour = parseInt(time/3600)-24*day; // 小时 60*60 总小时数-过去的小时数=现在的小时数
  124. var minute = parseInt(time%3600/60); // 分 -(day*24) 以60秒为一整份 取余 剩下秒数 秒数/60 就是分钟数
  125. var second = parseInt(time%60); // 以60秒为一整份 取余 剩下秒数
  126. obj.innerHTML="小Z同学<br>咱俩在一起的时间已经:<br>"+day+"天"+hour+"小时"+minute+"分"+second+"秒"+"了<br><span>圣诞之夜即将来临,真爱来了,我们要好好把握。<br>不管面临多大的压力,不管前面的路如何崎岖.<br>不管经历过什么,我仍坚信最浪漫的事就是和你一起慢慢变老.<br>相信中间的计时器,将永远继续下去,直至数据溢出.</span>"
  127. return true;
  128. }
  129. </script>
  130. </body>
  131. </html>

2、表白利器

 

表白利器:可替换照片,背景音乐等

【源码文末获取】

3、表白电子相册

动态表白相册:可替换照片等,或者直接使用表情包也是一番风味。

【源码文末获取】

4、表白动画

表白动画:动态展示照片和文字等,复古风哈哈

【源码文末获取】

5、爱心表白

爱心表白:动态爱心,动画跟随鼠标旋转

【源码文末获取】

三、全部源码获取

为遵守平台规范,请评论或私聊关键词“love”,获取全部源码地址

还不快快行动起来~不试试怎么知道!

据说  点赞评论+关注!的同学表白成功的概率翻倍噢~

网站建设定制开发 软件系统开发定制 定制软件开发 软件开发定制 定制app开发 app开发定制 app开发定制公司 电商商城定制开发 定制小程序开发 定制开发小程序 客户管理系统开发定制 定制网站 定制开发 crm开发定制 开发公司 小程序开发定制 定制软件 收款定制开发 企业网站定制开发 定制化开发 android系统定制开发 定制小程序开发费用 定制设计 专注app软件定制开发 软件开发定制定制 知名网站建设定制 软件定制开发供应商 应用系统定制开发 软件系统定制开发 企业管理系统定制开发 系统定制开发