❤聖誕節送女朋友❤ html+css+js 炫酷煙花表白(含音樂) 程序員表白

助力程序員撩妹手到擒來 html+css+js 煙花表白(含音樂)可自定義編輯文字

聖誕節快到了,是否是要給女友或者正在追求的妹子一點小驚喜呢 ? html+css+js 編寫的抖音煙花表白效果,酷炫迷人,助力程序員撩妹手到擒來,一路順風,祝願你們有情人終成眷屬,天長地久。。趕忙學會了,來製做屬於咱們程序員的浪漫吧!css

Web前端基於Canvas實現的煙花表白特效,基於對Canvas的理解實現,總會有那麼一段小驚喜,能夠驚豔到彼此短暫的時光。html

製做不易,須要源碼的朋友 添加qq 365392777

更多表白方式可點擊下方連接:

❤女友生日❤ HTML+css3+js 實現抖音炫酷櫻花3D相冊 (含背景音樂)程序員表白必備前端


動態效果圖(已兼容 H5移動端 和 pc端 )

在線演示地址vue

在這裏插入圖片描述
在這裏插入圖片描述

在這裏插入圖片描述
在這裏插入圖片描述
在這裏插入圖片描述

人狠話很少,直接上代碼

文件結構

在這裏插入圖片描述

html部分

<!-- * @Author: xf * @Date: 2020-12-21 09:07:44 * @LastEditTime: 2020-12-21 17:27:07 * @LastEditors: Please set LastEditors * @Description: In User Settings Edit * @FilePath: \firework-master\酷炫表白煙花\fire.html -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
    <link rel="stylesheet" href="css/style.css">
    <script id="jqbb" src="https://libs.baidu.com/jquery/1.11.1/jquery.min.js"></script>
    <style> body{ margin:0;padding:0;overflow: hidden;} .city{ width:100%;position:fixed;bottom: 0px;z-index: 100;} .city img{ width: 100%;} audio{  opacity: 0; } </style>
    <title>
        炫酷煙花表白
    </title>
    <!-- 彈窗樣式 -->
    <link href="modal.css" rel="stylesheet"/>

    <style type="text/css"> html, body {  background-color: black; overflow: hidden; user-select: none; margin: 0; } </style>
</head>
<body onselectstart="return false">
    <div class="star comet"></div>
    <script src="js/index.js"></script>
  
<!--對話部分-->
<div class="share_img"><img src="img/xin.png" alt=""></div>

<div class="page_one">
    <div class="content">
        <div class="text_wrapper">
            <img class="xin" src="img/xin.png" alt="" />
            <div class="text">
                小姐姐,我好喜歡你,你願意作我女友嗎?
            </div>
        </div>
    </div>
    <div class="btn-groups">
        <div class="heart-btn">
            <div id="yes" class="btn btn-a"><span>願意</span></div>
        </div>
        <div id="no" class="btn btn-b"><span>不肯意</span></div>
    </div>
</div>
<!--煙花部分-->
<canvas id='cas' style="background-color:rgba(0,5,24,1); z-index: 9999;">
    瀏覽器不支持canvas
</canvas>
<div class="city">
    <img src="img/city.png" alt="" />
</div>
<img src="img/moon.png" alt="" id="moon" style="visibility: hidden;" />
<div style="display:none">
    <div class="shape">
        520❤
    </div>
    <div class="shape">
       這裏自定義文字
    </div>
    <div class="shape">
        茫茫人海
    </div>
    <div class="shape">
        相遇是緣
    </div>
    <div class="shape">
        我愛你直到永遠
    </div>
</div>
<!--音樂部分-->
<audio autoplay loop id="music">
    <source src="mp3/music.mp3" />
</audio>
<iframe id="iframMusic" allow="autoplay" style="display:none" src="mp3/blank.mp3"></iframe>
<script src="jquery.min.js"></script>
<script src="fire.js"></script>
<script src="talk.js"></script>
</body>
... 製做不易,須要源碼的朋友 請添加 365392777
</html>

css 部分

* { 
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
}
.share_img { 
  width: 0;
  height: 0;
  overflow: hidden;
  opacity: 0;
}
.content { 
  /* padding: 80px 20px; */
}
.text_wrapper { 
  display: -webkit-box;
  display: flex;
}
.text_wrapper .text { 
  padding-top: 20px;
  padding-left: 20px;
}
.hide { 
  display: none !important;
}
p { 
  margin: 0;
}
.btn-groups { 
  padding-right: 20px;
  text-align: center;
}
.heart-btn { 
  display: inline-block;
  animation: breath 0.8s linear 0s infinite both;
  -webkit-animation: breath 0.8s linear 0s infinite both;
}
.btn { 
  position: relative;
  display: inline-block;
  width: 60px;
  height: 60px;
  margin: 0 30px;
  transform: rotate(45deg);
  -webkit-transform: rotate(45deg);
}
.btn span { 
  display: block;
  width: 100%;
  height: 100%;
  line-height: 60px;
  margin-top: -10px;
  margin-left: -10px;
  text-align: center;
  transform: rotate(-45deg);
  -webkit-transform: rotate(-45deg);
}
/* 願意 */
.btn-a { 
  background: pink;
}
.btn-b { 
  background: #c9c9c9;
}
.btn-b:after { 
  content: "";
  position: absolute;
  display: block;
  width: 60px;
  height: 30px;
  background: #c9c9c9;
  left: 0;
  top: -29px;
  border-top-left-radius: 60px;
  border-top-right-radius: 60px;
}
.container { 
}
.container .mask { 
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.3);
}
.container .modal { 
  width: 50%;
  height: 160px;
  position: absolute;
  top: 55%;
  left: 50%;
  padding: 20px 15px;
  border-radius: 5px;
  /* transform: translate(-50%, -70%); */
  -webkit-transform: translate(-50%, -0%);
  -webkit-transform: translate(-50%, -0%);
  background: #f3f3f3;
}
.container .modal p { 
  margin-top: 20px;
  margin-bottom: 20px;
  font-size: 16px;
  color: #353535;
  text-align: center;
}
.type_words { 
  padding: 12px 20px;
}
.page_one { 
  position: absolute;
  z-index: 10;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -90%);
}
.text { 
  color: pink;
  font-size: 16px;
}

.xin { 
  width: 20%;
}
... 製做不易,須要源碼的朋友 請添加 365392777

js部分

var canvas = document.getElementById("cas");
var ocas = document.createElement("canvas");
var octx = ocas.getContext("2d");
var ctx = canvas.getContext("2d");
ocas.width = canvas.width = window.innerWidth;
ocas.height = canvas.height = window.innerHeight;
var bigbooms = [];

// window.onload = function() { 
// initAnimate();
// };

document.getElementById("iframMusic").onload = function(){ 
    var music = document.getElementById("music");
    music.src = 'music.mp3';
    music.oncanplay = function(){ 
        music.play();
    };
};

function initAnimate() { 
    drawBg();
    lastTime = new Date();
    animate()
}
var lastTime;

function drawMoon() { 
    var moon = document.getElementById("moon");
    var centerX = canvas.width - 200,
        centerY = 100,
        width = 80;
    if (moon.complete) { 
        ctx.drawImage(moon, centerX, centerY, width, width)
    } else { 
        moon.onload = function() { 
            ctx.drawImage(moon, centerX, centerY, width, width)
        }
    }
    var index = 0;
    for (var i = 0; i < 10; i++) { 
        ctx.save();
        ctx.beginPath();
        ctx.arc(centerX + width / 2, centerY + width / 2, width / 2 + index, 0, 2 * Math.PI);
        ctx.fillStyle = "rgba(240,219,120,0.005)";
        index += 2;
        ctx.fill();
        ctx.restore()
    }
}
Array.prototype.foreach = function(callback) { 
    for (var i = 0; i < this.length; i++) { 
        if (this[i] !== null) { 
            callback.apply(this[i], [i])
        }
    }
};
var raf = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame ||
    function(callback) { 
        window.setTimeout(callback, 1000 / 60)
    };
canvas.onclick = function() { 
    var x = event.clientX;
    var y = event.clientY;
    var bigboom = new Boom(getRandom(canvas.width / 3, canvas.width * 2 / 3), 2, "#FFF", { 
        x: x,
        y: y
    });
    bigbooms.push(bigboom)
};
var Boom = function(x, r, c, boomArea, shape) { 
    this.booms = [];
    this.x = x;
    this.y = (canvas.height + r);
    this.r = r;
    this.c = c;
    this.shape = shape || false;
    this.boomArea = boomArea;
    this.theta = 0;
    this.dead = false;
    this.ba = parseInt(getRandom(80, 200))
};
Boom.prototype = { 
    _paint: function() { 
        ctx.save();
        ctx.beginPath();
        ctx.arc(this.x, this.y, this.r, 0, 2 * Math.PI);
        ctx.fillStyle = this.c;
        ctx.fill();
        ctx.restore()
    },
    _move: function() { 
        var dx = this.boomArea.x - this.x,
            dy = this.boomArea.y - this.y;
        this.x = this.x + dx * 0.01;
        this.y = this.y + dy * 0.01;
        if (Math.abs(dx) <= this.ba && Math.abs(dy) <= this.ba) { 
            if (this.shape) { 
                this._shapBoom()
            } else { 
                this._boom()
            }
            this.dead = true
        } else { 
            this._paint()
        }
    },
    _drawLight: function() { 
        ctx.save();
        ctx.fillStyle = "rgba(255,228,150,0.3)";
        ctx.beginPath();
        ctx.arc(this.x, this.y, this.r + 3 * Math.random() + 1, 0, 2 * Math.PI);
        ctx.fill();
        ctx.restore()
    },
    _boom: function() { 
        var fragNum = getRandom(30, 200);
        var style = getRandom(0, 10) >= 5 ? 1 : 2;
        var color;
        if (style === 1) { 
            color = { 
                a: parseInt(getRandom(128, 255)),
                b: parseInt(getRandom(128, 255)),
                c: parseInt(getRandom(128, 255))
            }
        }
Frag.prototype = { 
    paint: function() { 
        ctx.save();
        ctx.beginPath();
        ctx.arc(this.x, this.y, this.radius, 0, 2 * Math.PI);
        ctx.fillStyle = "rgba(" + this.color.a + "," + this.color.b + "," + this.color.c + ",1)";
        ctx.fill();
        ctx.restore()
    },
    moveTo: function(index) { 
        this.ty = this.ty + 0.3;
        var dx = this.tx - this.x,
            dy = this.ty - this.y;
        this.x = Math.abs(dx) < 0.1 ? this.tx: (this.x + dx * 0.1);
        this.y = Math.abs(dy) < 0.1 ? this.ty: (this.y + dy * 0.1);
        if (dx === 0 && Math.abs(dy) <= 80) { 
            this.dead = true
        }
        this.paint()
    }
};
... 製做不易,須要源碼的朋友 請添加 365392777

更多源碼

1.echart在線演示地址

2.基於 Echarts 實現可視化數據大屏響應式展現效果的源碼,共計100套,能夠在此基礎上從新開發(vue/react)均可以使用

3.❤女友生日❤ HTML+css3+js 實現抖音炫酷櫻花3D相冊 (含背景音樂)程序員表白必備

4.[免費部署上線工具]->不須要服務器就能將項目部署上線

5.❤前端 html+css+js[1000個超炫酷特效] 當我學會這招,全部炫酷的特效頁面(含源碼)都能下載下來啦!

6.抖音超火❤羅盤時鐘(免費附源碼)

一萬年太長,和你在一塊兒,只爭朝夕。
情書給你一封,情話給你一句,餘生給你一人。
我想要的將來,就是天天早上起牀,都能看見你和陽光都在。

react

相關文章
相關標籤/搜索