给大家介绍两款好看浪漫的祝福代码
2025新年快乐
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="year_files/main.css">
<!-- 这里修改标题 -->
<title>2025新年快乐</title>
<script>
// 这里是祝福
var bless = [
"点击屏幕开启背景音乐!",
"陪大家一起跨年了!",
"新的一年里,希望大家开心,快乐,健康♥",
"2025新年快乐"
]
// 祝福文字修改
var blessStyle = {
color: "#c7f0ff", // 文字颜色
shadowColor: "#00aeec",// 文字阴影颜色
fontSize: "3", // 文字大小
blod: 1 // 文字加粗,1加粗,0不加粗
}
// 音乐配置
var music = {
src: "./year_files/music.mp3", // 音乐地址,不需要音乐,写成""
loop: 1, // 音乐循环播放吗? 1循环播放 0 只播放一遍
volume: 1, // 音乐大小,默认为1,范围【0~1】,注意0~1
}
</script>
</head>
<body onselectstart="return false">
</div>
<canvas id="cas" style="background-color:rgba(0,5,24,1)" width="100%" height="100%">不支持canvas</canvas>
<div class="city">
<img src="./year_files/city.png" alt="city_png">
</div>
<img src="./year_files/moon.png" alt="" id="moon" style="visibility: hidden;">
<div class="content show" style="color: rgb(199, 240, 255); text-shadow: rgb(0, 174, 236) 0px 0px 10px; font-size: 3rem; font-weight: 700;">2025新年快乐</div>
<script src="./year_files/main.js"></script>
</body>
</html>
还需要配置其他文件才能执行出以下视频效果:
<iframe allowfullscreen="true" data-mediaembed="bilibili" frameborder="0" id="hqgN0AFu-1736247268167" src="https://player.bilibili.com/player.html?aid=113786585351576"></iframe>2025新年祝福和照片环绕HTML离线模板可以自己更改音乐照片等等
爱心照片走廊照片墙3d环形
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>3d照片表白墙</title>
<style>
* {
margin: 0;
padding: 0;
}
html,
body {
height: 100%;
touch-action: none;
}
/* perspective指定了观察者与 Z=9 平面的距离,使具有三维位置变换的元素产生透视效果。 */
body {
overflow: hidden;
display: flex;
perspective: 1000px;
background: #111;
}
@property --d {
syntax: '<angle>';
inherits: true;
initial-value: 0deg;
}
.点击我 {
width: 40px;
aspect-ratio: 1;
font-size: 30px;
color: #fff;
background: none;
border: none;
border-radius: 20px;
position: relative;
z-index: 0;
transition: .3s;
cursor: pointer;
}
.点击我:before {
content: "";
position: absolute;
inset: -8px;
padding: 8px;
border-radius: 28px;
background: conic-gradient(from var(--d, 0deg),
#21D4FD,
#0000 30deg 120deg,
#B721FF 150deg 180deg,
#0000 210deg 300deg,
#21D4FD 330deg);
-webkit-mask:
linear-gradient(#000 0 0) content-box,
linear-gradient(#000 0 0);
-webkit-mask-composite: xor;
mask-composite: intersect
}
.点击我:after {
content: "";
position: absolute;
inset: -100px;
background:
radial-gradient(80px at left 150px top 120px, #21D4FD 98%, #0000),
radial-gradient(80px at right 150px bottom 120px, #B721FF 98%, #0000);
filter: blur(60px);
opacity: .5;
}
.点击我:before,
.点击我:after {
transition: .5s, 99999s 99999s transform, 99999s 99999s --d;
}
.点击我:hover {
box-shadow: 0 0 0 1px #666;
}
.点击我:hover:after {
transform: rotate(3600deg);
transition: .5s, 60s linear transform;
}
.点击我:hover:before {
--d: 3600deg;
transition: .5s, 60s linear --d;
}
.点击我:hover:before {
background-color: #222;
}
.点击我_shell {
margin: 0;
/* min-height: 100vh; */
display: grid;
place-content: center;
grid-auto-flow: column;
background-color: #1b1b1c;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
#dragBox,
.spinBox {
position: relative;
display: flex;
margin: auto;
transform-style: preserve-3d;
transform: rotateX(-10deg);
}
#dragBox {
transform: rotateX(-30deg)
}
.spinBox {
width: 120px;
height: 140px;
animation: spin 200s infinite linear;
}
#spinBox2 {
position: absolute;
top: 120%;
}
#spinBox3 {
position: absolute;
top: -120%;
}
#dragBox img {
transform-style: preserve-3d;
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
box-shadow: 0 0 8px #fff;
/*倒影 */
-webkit-box-reflect: below 10px linear-gradient(transparent, transparent, #0005);
}
#dragBox img:hover {
box-shadow: 0 0 15px #fff;
}
/*自动旋转 */
@keyframes spin {
from {
transform: rotateY(0deg);
}
to {
transform: rotateY(360deg);
}
}
</style>
</head>
<body>
<div class="点击我_shell" id="点击我_shell">
<audio loop src="img/落在生命里的光-尹昔眠.m4a" id="audio" autoplay preload="auto"></audio>
<button class="点击我">点击我</button>
</div>
<div id="dragBox">
<div class="spinBox" id="spinBox">
<img src="img/a1.png">
<img src="img/a2.png">
<img src="img/a3.png">
<img src="img/a4.png">
<img src="img/a6.png">
<img src="img/a7.png">
<img src="img/a8.png">
<img src="img/a1.png">
<img src="img/a2.png">
<img src="img/a3.png">
<img src="img/a4.png">
<img src="img/a6.png">
<img src="img/a7.png">
<img src="img/a8.png">
<img src="img/a1.png">
<img src="img/a2.png">
<img src="img/a3.png">
<img src="img/a4.png">
<img src="img/a6.png">
<img src="img/a7.png">
<img src="img/a8.png">
</div>
<div class="spinBox" id="spinBox2">
<img src="img/a2.png">
<img src="img/a3.png">
<img src="img/a4.png">
<img src="img/a6.png">
<img src="img/a7.png">
<img src="img/a8.png">
<img src="img/a1.png">
<img src="img/a2.png">
<img src="img/a3.png">
<img src="img/a4.png">
<img src="img/a6.png">
<img src="img/a7.png">
<img src="img/a8.png">
<img src="img/a1.png">
<img src="img/a2.png">
<img src="img/a3.png">
<img src="img/a4.png">
<img src="img/a6.png">
<img src="img/a7.png">
<img src="img/a8.png">
<img src="img/a1.png">
</div>
<div class="spinBox" id="spinBox3">
<img src="img/a3.png">
<img src="img/a4.png">
<img src="img/a6.png">
<img src="img/a7.png">
<img src="img/a8.png">
<img src="img/a1.png">
<img src="img/a2.png">
<img src="img/a3.png">
<img src="img/a4.png">
<img src="img/a6.png">
<img src="img/a7.png">
<img src="img/a8.png">
<img src="img/a2.png">
<img src="img/a3.png">
<img src="img/a4.png">
<img src="img/a6.png">
<img src="img/a7.png">
<img src="img/a8.png">
<img src="img/a1.png">
<img src="img/a2.png">
</div>
</div>
<script>
let radius = 560;
//相册展开大小
let outDom = document.getElementById("dragBox");
outDom.style.display = 'none';
let spinDom = document.getElementById("spinBox");
let spinDom2 = document.getElementById("spinBox2");
let spinDom3 = document.getElementById("spinBox3");
let aImg = spinDom.getElementsByTagName('img');
let aImg2 = spinDom2.getElementsByTagName('img');
let aImg3 = spinDom3.getElementsByTagName('img');
let aEle = [...aImg];
let aEle2 = [...aImg2];
let aEle3 = [...aImg3];
function setStyle(delayTime, dom, i, len) {
//给元素加动画 展开
dom.style.transform = "rotateY(" + (i * (360 / len)) + "deg) translateZ(" + radius + "px)";
dom.style.transition = "transform 1s";
dom.style.transitionDelay = delayTime || (len - i) / 4 + "s";
}
function init(delayTime) {
for (let i = 0; i < aEle.length; i++) {
setStyle(delayTime, aEle[i], i, aEle.length)
}
for (let i = 0; i < aEle2.length; i++) {
setStyle(delayTime, aEle2[i], i, aEle2.length)
}
for (let i = 0; i < aEle3.length; i++) {
setStyle(delayTime, aEle3[i], i, aEle3.length)
}
}
let 点击我_shell = document.getElementById("点击我_shell")
点击我_shell.onclick = () => {
/* console.log('点击了') */
outDom.style.display = '';
点击我_shell.style.display = 'none';
let audio = document.getElementById('audio');
audio.play();
! function (e, t, a) {
function r() {
for (var e = 0; e < s.length; e++) s[e].alpha <= 0 ? (t.body.removeChild(s[e].el), s.splice(e,
1)) : (s[
e].y--, s[e].scale += .004, s[e].alpha -= .013, s[e].el.style.cssText = "left:" + s[
e].x +
"px;top:" + s[e].y + "px;opacity:" + s[e].alpha + ";transform:scale(" + s[e].scale +
"," + s[e]
.scale + ") rotate(45deg);background:" + s[e].color + ";z-index:99999");
requestAnimationFrame(r)
}
function n() {
var t = "function" == typeof e.onclick && e.onclick;
e.onclick = function (e) {
t && t(), o(e)
}
}
function o(e) {
var a = t.createElement("div");
a.className = "heart", s.push({
el: a,
x: e.clientX - 5,
y: e.clientY - 5,
scale: 1,
alpha: 1,
color: c()
}), t.body.appendChild(a)
}
function i(e) {
var a = t.createElement("style");
a.type = "text/css";
try {
a.appendChild(t.createTextNode(e))
} catch (t) {
a.styleSheet.cssText = e
}
t.getElementsByTagName("head")[0].appendChild(a)
}
function c() {
return "rgb(" + ~~(255 * Math.random()) + "," + ~~(255 * Math.random()) + "," + ~~(255 * Math
.random()) + ")"
}
var s = [];
e.requestAnimationFrame = e.requestAnimationFrame || e.webkitRequestAnimationFrame || e
.mozRequestAnimationFrame || e.oRequestAnimationFrame || e.msRequestAnimationFrame || function (
e) {
setTimeout(e, 1e3 / 60)
}, i(
".heart{width: 10px;height: 10px;position: fixed;background: #f00;transform: rotate(45deg);-webkit-transform: rotate(45deg);-moz-transform: rotate(45deg);}.heart:after,.heart:before{content: '';width: inherit;height: inherit;background: inherit;border-radius: 50%;-webkit-border-radius: 50%;-moz-border-radius: 50%;position: fixed;}.heart:after{top: -5px;}.heart:before{left: -5px;}"
), n(), r()
}(window, document);
setTimeout(init, 1000);
}
//鼠标滚动事件
document.onmousewheel = function (e) {
e || e.window.event;
let d = e.wheelDelta / 20 || -e.detail;
radius += d;
//展开大小
init(1);
}
//暂停开始旋转
function playSpin(yes) {
spinDom.style.animationPlayState = (yes ? 'running' : 'paused');
}
function changeRotate(obj) {
// X轴旋转0-180度
if (tY > 180)
tY = 180;
if (tY < 0)
tY = 0;
// y轴旋转角度不限制
obj.style.transform = "rotateX(" + (-tY) + "deg) rotateY(" + (tX) + "deg)";
}
let startX, startY, endX, endY, tX = 0,
tY = 10,
desX = 0,
desY = 0;
//鼠标移动事件
document.onpointerdown = function (e) {
//清除惯性定时器
clearInterval(outDom.timer);
e = e || ewindow.event;
//鼠标点击位置
startX = e.clientX, startY = e.clientY;
this.onpointermove = function (e) {
playSpin(false);
//鼠标点击时 停止自动旋转//鼠标点击时 停止自动旋转
e = e || window.event;
//记录结束时位置
endX = e.clientX,
endY = e.clientY;
//计算移动距离 并修改角度
desX = endX - startX;
desY = endY - startY;
tX += desX * 0.1;
tY += desY * 0.1;
changeRotate(outDom);
startX = endX;
startY = endY;
}
//鼠标离开时 开始自动旋转
this.onpointerup = function (e) {
//惯性旋转
outDom.timer = setInterval(function () {
desX *= 0.95;
desY *= 0.95;
tX += desX * 0.1;
tY += desY * 0.1;
changeRotate(outDom);
playSpin(false);
if (Math.abs(desX) < 0.5 && Math.abs(desY) < 0.5) {
clearInterval(outDom.timer);
playSpin(true);
}
})
this.onpointermove = this.onpointerup = null;
}
return false;
}
</script>
</body>
</html>
需要下载完整配置文件才能正常运行视频效果:
<iframe allowfullscreen="true" data-mediaembed="bilibili" frameborder="0" id="KTAKg7a1-1736247475495" src="https://player.bilibili.com/player.html?aid=113786585351576"></iframe>2025新年祝福和照片环绕HTML离线模板可以自己更改音乐照片等等
标签:function,style,离线,transform,照片,2025,点击,let,outDom From: https://blog.csdn.net/m0_73646984/article/details/144991457