时间:2023-07-26 13:12:02 | 来源:网站运营
时间:2023-07-26 13:12:02 来源:网站运营
520情人节表白网页代码~html+css+js浪漫星空❤爱心3D相册 (含音乐):一年一度的/520情人节/七夕情人节/生日礼物/告白师妹/圣诞节/元旦节跨年/程序员表白
,是不是要给女朋友或者正在追求的妹子一点小惊喜呢,今天这篇博客就分享下前端代码html+css+javascript 如何实现3D立体动态相册。赶紧学会了,来制作属于我们程序员的浪漫吧!<body> <audio autoplay="autopaly"> <source src="renxi.mp3" type="audio/mp3" /> </audio> <!-- 星空html --> <!-- <div> --> <div class="container2"> <div class="content"> <canvas id="universe"></canvas> </div> </div> <!-- </div> --> <div class="title"> <!-- 星团文字html --> <h3 class="STARDUST1"> 2016 - 2021</h3> <h1 class="STARDUST2">小夕-相遇是缘</h1> <h3 class="STARDUST3">L O V E <strong>❤</strong> Y O U</h3> <!-- 爱心html --> <img class="img" src="./123.png" alt="" /> <canvas id="pinkboard"> </canvas> </div> </body>
<!-- 星团js --> <script> let particles = []; let microparticles = []; const c1 = createCanvas({ width: $(window).width(), height: $(window).height(), }); const tela = c1.canvas; const canvas = c1.context; // $("body").append(tela); $("body").append(c1.canvas); setTimeout( function () { clearInterval(this.ID); }.bind(this), this.life ); } render() { this.canvas.beginPath(); this.canvas.arc(this.x, this.y, this.radius, 0, 2 * Math.PI); // this.canvas.lineWidth = 2; this.canvas.shadowOffsetX = 0; this.canvas.shadowOffsetY = 0; // this.canvas.shadowBlur = 6; this.canvas.shadowColor = "#000000"; this.canvas.fillStyle = this.color; this.canvas.fill(); this.canvas.closePath(); } move() { this.x -= this.direction * Math.sin(this.progress / (this.random1 * 430)) * this.s; this.y -= Math.cos(this.progress / this.h) * this.s; if (this.x < 0 || this.x > this.w - this.radius) { clearInterval(this.ID); return false; } if (this.y < 0) { clearInterval(this.ID); return false; } this.render(); this.progress++; return true; } } setInterval( function () { particles.push(new Particle1(canvas)); random_life = 2000 * Math.random(); }.bind(this), random_life ); function clear() { let grd = canvas.createRadialGradient( tela.width / 2, tela.height / 2, 0, tela.width / 2, tela.height / 2, tela.width ); grd.addColorStop(0, "rgba(20,20,20,1)"); grd.addColorStop(1, "rgba(0,0,0,0)"); // Fill with gradient canvas.globalAlpha = 0.16; canvas.fillStyle = grd; canvas.fillRect(0, 0, tela.width, tela.height); } function update() { clear(); particles = particles.filter(function (p) { return p.move(); }); microparticles = microparticles.filter(function (mp) { return mp.move(); }); requestAnimationFrame(update.bind(this)); } function createCanvas(properties) { let canvas = document.createElement("canvas"); canvas.width = properties.width; // canvas.style.zIndex = 999; canvas.height = properties.height; let context = canvas.getContext("2d"); return { canvas: canvas, context: context, }; } update(); </script>
mp3
背景音乐,可自行下载更换即可~ mp3免费下载地址 1.搜索需要的歌曲关键词:星空,浪漫,音乐,相册,表白