情人节程序员用HTML网页表白【情人相册模板】 HTML5七夕情人节表白网页源码 HTML+CSS+JavaScript

这是程序员表白系列中的100款网站表白之一,旨在让任何人都能使用并创建自己的表白网站给心爱的人看。 此波共有100个表白网站,可以任意修改和使用,很多人会希望向心爱的男孩女孩告白,生性腼腆的人即使那个TA站在眼前都不敢向前表白。说不出口的话就用短视频告诉TA吧~制作一个表白网页告诉TA你的心意,演示如下。

一、网页介绍

1 网页简介:基于 HTML+CSS+JavaScript 制作七夕情人节表白网页、生日祝福、七夕告白、 求婚、浪漫爱情3D相册、炫酷代码 ,快来制作一款高端的表白网页送(他/她)浪漫的告白,制作修改简单,可自行更换背景音乐,文字和图片即可使用

2.网页编辑:任意HTML编辑软件(如:Dreamweaver、HBuilder、Vscode 、Sublime 、Webstorm、Text 、Notepad++ 等任意html编辑软件进行运行及修改编辑等操作)。


一、网页效果

在这里插入图片描述
在这里插入图片描述

二、代码展示

1.HTML代码

代码如下(示例):以下仅展示部分代码供参考~

<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8" />
    <title>七夕情人节- 动漫3D相册告白</title>
        <!-- 播放器css -->
        <link rel="stylesheet" href="./css/common.css" />
        <!-- 相册css -->
        <link type="text/css" href="./css/style.css" rel="stylesheet" />
        <script
        id="jqbb"
        src="https://libs.baidu.com/jquery/1.11.1/jquery.min.js"
      ></script>
    <style type="text/css">
        body {
            margin: 0;
            position: relative;
        }

        .raining {
            display: block;
        }
      /* 背景图片 */
        .backimg {
            position: absolute;
            left: 0;
            top: 0;
            background: url(img/20.jpg);
            height: 100%;
            width: 100%;
            opacity: 0.3;
        }

        .audio {
            position: absolute;
            left: 0;
            top: 0;
        }
    </style>
</head>

<body>
    <!-- 烟花 -->
    <canvas class="raining"></canvas>
    <!-- 打字 -->
    <div class="typing">
    <!-- 字幕 -->
    <h2 class="header-sub-title" id="word"></h2>
    <h2 class="header-sub-title blink">|</h2>
    </div>
    <!-- 相册 -->
    <div class="box">
        <ul class="minbox">
          <li></li>
          <li></li>
          <li></li>
          <li></li>
          <li></li>
          <li></li>
        </ul>
        <ol class="maxbox">
          <li></li>
          <li></li>
          <li></li>
          <li></li>
          <li></li>
          <li></li>
        </ol>
      </div>
     <!-- 播放器 -->
    <div id="app">
        <div class="container_player">
          <div class="music-box">
            <!-- 播放器相片 -->
            <img src="img/01.png" />
            <div class="mask">
              <div class="mplayer" onclick="play()">
                <i class="fa">
                  <span class="before"></span>
                  <span class="after"> </span>
                </i>
                <svg
                  class="loadingSvg"
                  width="25"
                  height="25"
                  viewBox="0,0,50,50"
                  style="
                    position: absolute;
                    top: 50%;
                    left: 50%;
                    transform: translate(-50%, -50%);
                  "
                >
                  <circle></circle>
                </svg>
              </div>
              <div class="m-circle m-progress">
                <svg width="163" height="163" viewBox="0,0,163,163">
                  <circle
                    cx="81"
                    cy="81"
                    r="159"
                    stroke-width="8"
                    stroke="rgba(255, 206, 113, 0.2)"
                    fill="rgba(0,0,0,.2)"
                  ></circle>
                  <circle
                    class="a"
                    cx="81"
                    cy="81"
                    r="159"
                    stroke-width="6"
                    stroke="rgba(255, 206, 113, 1)"
                    fill="none"
                    stroke-dasharray="0 999"
                    transform="matrix(0,-1,1,0,0,163)"
                  ></circle>
                </svg>
              </div>
              <div class="m_time">
                <span class="mplayer_curtime">00:00</span>
                <span class="m-join">/</span>
                <span class="mplayer_durtime">00:00</span>
              </div>
            </div>
          </div>
        </div>
      </div>
      <!-- 音乐 -->
      <audio id="myAudio" src="./azn.mp3" loop="loop" ></audio>
    <div class="backimg"></div>
</body>
<script type="text/javascript" src="js/christmassnow.js"></script>
<script src="js/common.js"></script>
<script type="text/javascript">
$(document).ready(function(){
    /* 自动播放音乐 */
  play()
})
/* 烟花 */
    var canvas = document.querySelector(".raining");
    var w, h;
    ~~ function setSize() { //定义canvas的宽高,让他跟浏览器的窗口的宽高相同
        window.onresize = arguments.callee;
        w = window.innerWidth;
        h = window.innerHeight;
        canvas.width = w;
        canvas.height = h;
    }();

    var canCon = canvas.getContext("2d"); //建立2d画板
    var arain = []; //新建数组,储存雨滴
    //
    function random(min, max) { //返回最小值到最大值之间的值
        return Math.random() * (max - min) + min;
    }

    function rain() {};
    rain.prototype = {
        init: function() { //变量初始化
            this.x = random(0, w); //在0-w之间生成雨滴
            this.vx = 0.1;
            this.y = h; //起点在下面
            this.vy = random(4, 5);
            this.h = random(0.1 * h, 0.4 * h); //地板高度
            this.r = 1; //雨滴绽放的半径
            this.vr = 1;
            this.colos = Math.floor(Math.random() * 1000);
        },
        draw: function() {

            if (this.y > this.h) {
                canCon.beginPath(); //拿起一支笔
                canCon.fillStyle = '#' + this.colos; //笔墨的颜色,随机变化的颜色
                canCon.fillRect(this.x, this.y, 3, 10); //想象画一个雨滴
            } else {
                canCon.beginPath(); //拿起一支笔
                canCon.strokeStyle = '#' + this.colos; //笔墨的颜色
                canCon.arc(this.x, this.y, this.r, 0, Math.PI * 2); //想象画一个圆
                canCon.stroke(); //下笔作画
            }
        },
        move: function() { //重点是判断和初始位置。其他无大变化
            if (this.y > this.h) { //位置判断
                this.y += -this.vy; //从下往上				

            } else {
                if (this.r < 100) { //绽放的大小
                    this.r += this.vr;
                } else {
                    this.init(); //放完后回归变量原点
                }

            }
            this.draw(); //开始作画

        }
    }

    function createrain(num) {
        for (var i = 0; i < num; i++) {
            setTimeout(function() {
                var raing = new rain(); //创建一滴雨
                raing.init();
                raing.draw();
                arain.push(raing);
            }, 800 * i) //每隔150ms下落一滴雨
        }
    }
    createrain(10); //雨滴数量
    setInterval(function() {
        canCon.fillStyle = "rgba(0,0,0,0.1)"; //拿起一支透明0.13的笔		
        canCon.fillRect(0, 0, w, h); //添加蒙版 控制雨滴长度
        for (var item of arain) {
            //item of arain指的是数组里的每一个元素
            //item in arain指的是数组里的每一个元素的下标(包括圆形连上的可遍历元素)
            item.move(); //运行整个move事件
        }
    }, 1000 / 60); //上升时间


    
     // -----------打印字-----------
     const words = [
      "❤亲爱的,今天是我们在一起的第520天",
      "❉ 月梅星稀鸣蝉哀,胡琴曲幽谁人拉",
      "❉ 今夜无人盈袖拂,时逢科举缘是由",
      "❉ 你的笑,我无法忘掉",
      "❉ 你的好,温暖我心潮",
      "❉ 你的美,如秋月皎皎",
      "❉ 我的爱,如秋水淼淼",
      "❉ 陪着你一直到老",
      "❉ 亲爱的,七夕到了",
      "❉ 陪着你度过生命中的每一个七夕",
    ];
    let i = 0;
    let timer;
    // speed in ms
    let deleteDelay = 3000;
    let typeSpeed = 100;
    let delSpeed = 50;
    /* 开始编写文字 */
    function typingEffect() {
      let word = words[i].split("");
      var loopTyping = function () {
        if (word.length > 0) {
          document.getElementById("word").innerHTML += word.shift();
        } else {
          delay(function () {
            deletingEffect(); // do stuff
          }, deleteDelay); // end delay
          // deletingEffect();
          return false;
        }
        timer = setTimeout(loopTyping, typeSpeed);
      };
      loopTyping();
    }

    function deletingEffect() {
      let word = words[i].split("");
      var loopDeleting = function () {
        if (word.length > 0) {
          word.pop();
          document.getElementById("word").innerHTML = word.join("");
        } else {
          if (words.length > i + 1) {
            i++;
          }
          else {
            i = 0;
          }
          typingEffect();
          return false;
        }

        timer = setTimeout(loopDeleting, delSpeed);
      };

      loopDeleting();
    }

    var delay = (function () {
      var timer = 0;
      return function (callback, ms) {
        clearTimeout(timer);
        timer = setTimeout(callback, ms);
      };
    })();
    /* 开始打印字 */
    typingEffect();
 
</script>

</html>



2.CSS代码


@charset "utf-8";
* {
  margin: 0;
  padding: 0;
}
body {
  max-width: 100%;
  min-width: 100%;
  height: 100%;
  background-size: cover;
  background-repeat: no-repeat;
  background-attachment: fixed;
  background-size: 100% 100%;
  position: absolute;
  margin-left: auto;
  margin-right: auto;
}
li {
  list-style: none;
}

.box {
  z-index: 999999 !important;
  width: 200px;
  height: 200px;
  background-size: cover;
  background-repeat: no-repeat;
  background-attachment: fixed;
  background-size: 100% 100%;
  position: fixed !important;
  top: 42%;
  left: 40%;
  -webkit-transform-style: preserve-3d;
  -webkit-transform: rotateX(13deg);
  -webkit-animation: move 5s linear infinite;
}
.minbox {
  width: 100px;
  height: 100px;
  position: absolute;
  left: 50px;
  top: 30px;
  -webkit-transform-style: preserve-3d;
}
.minbox li {
  width: 100px;
  height: 100px;
  position: absolute;
  left: 0;
  top: 0;
}
.minbox li:nth-child(1) {
  background: url(../img/01.png) no-repeat 0 0;
  -webkit-transform: translateZ(50px);
}
.minbox li:nth-child(2) {
  background: url(../img/02.png) no-repeat 0 0;
  -webkit-transform: rotateX(180deg) translateZ(50px);
}
.minbox li:nth-child(3) {
  background: url(../img/03.png) no-repeat 0 0;
  -webkit-transform: rotateX(-90deg) translateZ(50px);
}
.minbox li:nth-child(4) {
  background: url(../img/04.png) no-repeat 0 0;
  -webkit-transform: rotateX(90deg) translateZ(50px);
}
.minbox li:nth-child(5) {
  background: url(../img/05.png) no-repeat 0 0;
  -webkit-transform: rotateY(-90deg) translateZ(50px);
}
.minbox li:nth-child(6) {
  background: url(../img/06.png) no-repeat 0 0;
  -webkit-transform: rotateY(90deg) translateZ(50px);
}
.maxbox li:nth-child(1) {
  background: url(../img/1.png) no-repeat 0 0;
  -webkit-transform: translateZ(50px);
}
.maxbox li:nth-child(2) {
  background: url(../img/2.png) no-repeat 0 0;
  -webkit-transform: translateZ(50px);
}
.maxbox li:nth-child(3) {
  background: url(../img/3.png) no-repeat 0 0;
  -webkit-transform: rotateX(-90deg) translateZ(50px);
}
.maxbox li:nth-child(4) {
  background: url(../img/4.png) no-repeat 0 0;
  -webkit-transform: rotateX(90deg) translateZ(50px);
}
.maxbox li:nth-child(5) {
  background: url(../img/5.png) no-repeat 0 0;
  -webkit-transform: rotateY(-90deg) translateZ(50px);
}
.maxbox li:nth-child(6) {
  background: url(../img/6.png) no-repeat 0 0;
  -webkit-transform: rotateY(90deg) translateZ(50px);
}
.maxbox {
  width: 800px;
  height: 400px;
  position: absolute;
  left: 0;
  top: -20px;
  -webkit-transform-style: preserve-3d;
}
.maxbox li {
  width: 200px;
  height: 200px;
  background: #fff;
  border: 1px solid #ccc;
  position: absolute;
  left: 0;
  top: 0;
  opacity: 0.2;
  -webkit-transition: all 1s ease;
}
.maxbox li:nth-child(1) {
  -webkit-transform: translateZ(100px);
}
.maxbox li:nth-child(2) {
  -webkit-transform: rotateX(180deg) translateZ(100px);
}
.maxbox li:nth-child(3) {
  -webkit-transform: rotateX(-90deg) translateZ(100px);
}
.maxbox li:nth-child(4) {
  -webkit-transform: rotateX(90deg) translateZ(100px);
}
.maxbox li:nth-child(5) {
  -webkit-transform: rotateY(-90deg) translateZ(100px);
}
.maxbox li:nth-child(6) {
  -webkit-transform: rotateY(90deg) translateZ(100px);
}
.box:hover ol li:nth-child(1) {
  -webkit-transform: translateZ(300px);
  width: 400px;
  height: 400px;
  opacity: 0.8;
  left: -100px;
  top: -100px;
}
.box:hover ol li:nth-child(2) {
  -webkit-transform: rotateX(180deg) translateZ(300px);
  width: 400px;
  height: 400px;
  opacity: 0.8;
  left: -100px;
  top: -100px;
}
.box:hover ol li:nth-child(3) {
  -webkit-transform: rotateX(-90deg) translateZ(300px);
  width: 400px;
  height: 400px;
  opacity: 0.8;
  left: -100px;
  top: -100px;
}
.box:hover ol li:nth-child(4) {
  -webkit-transform: rotateX(90deg) translateZ(300px);
  width: 400px;
  height: 400px;
  opacity: 0.8;
  left: -100px;
  top: -100px;
}
.box:hover ol li:nth-child(5) {
  -webkit-transform: rotateY(-90deg) translateZ(300px);
  width: 400px;
  height: 400px;
  opacity: 0.8;
  left: -100px;
  top: -100px;
}
.box:hover ol li:nth-child(6) {
  -webkit-transform: rotateY(90deg) translateZ(300px);
  width: 400px;
  height: 400px;
  opacity: 0.8;
  left: -100px;
  top: -100px;
}
@keyframes move {
  0% {
    -webkit-transform: rotateX(13deg) rotateY(0deg);
  }
  100% {
    -webkit-transform: rotateX(13deg) rotateY(360deg);
  }
}
/* 雪花css */
.snowLayer {
  position: absolute;
  left: -400px;
  top: -400px;
  height: 2000px !important;
  overflow: hidden;
}
.blink {
  animation: blink 0.5s infinite;
  animation-delay: 500ms;
}

@keyframes blink {
  to {
    opacity: 0;
  }
}

.typing {
  display: flex;
  top: 10%;
  left: 4%;
  z-index: 999999 !important;
  position: fixed !important;
}

.header-sub-title,
h2 {
  font-weight: 600;
  font-size: 40px;
  color: skyblue;
  padding-right: 0.1em;
  text-transform: uppercase;
}



三、精彩专栏

看到这里了就 【点赞,关注,收藏】 三连 支持下吧,你的支持是我创作的动力。

  • 8
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值