feat(guess): 添加猜歌游戏胜利音效和优化样式
- 新增triumph.mp3作为胜利音效 - 优化guess.css中的动画效果和布局 - 调整guess.js中的音频播放逻辑和状态管理 - 更新guess.html页面结构和样式 - 修改song-request-station.js中的音频源路径
This commit is contained in:
186
2.html
186
2.html
@@ -1,95 +1,95 @@
|
||||
<!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>CSS实现卡片边框渐变动画</title>
|
||||
</head>
|
||||
<link rel="stylesheet" href="../common.css" />
|
||||
<style>
|
||||
/* 引入字体 */
|
||||
@import url("https://fonts.googleapis.com/css?family=Amatic+SC");
|
||||
|
||||
body {
|
||||
/* 添加透视效果 */
|
||||
transform-style: preserve-3d;
|
||||
perspective: 1800px;
|
||||
}
|
||||
|
||||
.card {
|
||||
width: 300px;
|
||||
height: 200px;
|
||||
border-radius: 15px;
|
||||
box-shadow: 0 10px 20px 20px rgba(0, 0, 0, 0.17);
|
||||
/* 修改角度为--rotate */
|
||||
background: linear-gradient(var(--rotate), #ff1d74, #e3820c 43%, #c28846);
|
||||
/* 添加旋转动画 */
|
||||
animation: bg 2.5s infinite linear;
|
||||
position: relative;
|
||||
/* transform: rotateX(10deg) rotateY(15deg); */
|
||||
}
|
||||
|
||||
.card::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
width: 296px;
|
||||
height: 196px;
|
||||
left: calc(50% - 148px);
|
||||
top: calc(50% - 98px);
|
||||
background: #222;
|
||||
border-radius: 15px;
|
||||
}
|
||||
|
||||
.card span {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
z-index: 1;
|
||||
left: 0;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
font-size: 26px;
|
||||
font-weight: bold;
|
||||
color: #fff;
|
||||
letter-spacing: 2px;
|
||||
font-family: "Amatic SC";
|
||||
cursor: default;
|
||||
/* 添加过渡效果 */
|
||||
transition: all 0.5s;
|
||||
}
|
||||
|
||||
/* span添加hover */
|
||||
.card:hover span {
|
||||
background: linear-gradient(45deg, #ff1d74, #e3820c 43%, #c28846);
|
||||
color: transparent;
|
||||
background-clip: text;
|
||||
-webkit-background-clip: text;
|
||||
}
|
||||
|
||||
/* 定义@property */
|
||||
@property --rotate {
|
||||
syntax: "<angle>";
|
||||
initial-value: 0deg;
|
||||
inherits: false;
|
||||
}
|
||||
|
||||
@keyframes bg {
|
||||
0% {
|
||||
--rotate: 0deg;
|
||||
}
|
||||
|
||||
100% {
|
||||
--rotate: 360deg;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<body>
|
||||
<div class="card">
|
||||
<span>苏苏就是小苏苏888</span>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Item Appear Animation</title>
|
||||
<link rel="stylesheet" href="styles.css" />
|
||||
<style>
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="box" id="animationContainer">
|
||||
<div class="wave-bg"></div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
const container = document.getElementById('animationContainer');
|
||||
let containerWidth = container.offsetWidth;
|
||||
let containerHeight = container.offsetHeight;
|
||||
|
||||
// 颜色数组
|
||||
const colors = [
|
||||
'#FF6B6B', '#4ECDC4', '#45B7D1', '#FFA5A5', '#845EC2',
|
||||
'#D65DB1', '#FF6F91', '#FF9671', '#FFC75F', '#F9F871',
|
||||
'#00B894', '#0984E3', '#6C5CE7', '#A29BFE', '#FD79A8'
|
||||
];
|
||||
|
||||
// 创建指定数量的动画元素
|
||||
const createAnimatedItems = (count) => {
|
||||
for (let i = 0; i < count; i++) {
|
||||
setTimeout(() => {
|
||||
createSingleItem();
|
||||
}, i * 100); // 每个元素间隔100ms创建
|
||||
}
|
||||
};
|
||||
|
||||
// 创建单个动画元素
|
||||
const createSingleItem = () => {
|
||||
const item = document.createElement('div');
|
||||
item.classList.add('animated-item');
|
||||
|
||||
// 随机大小
|
||||
const size = Math.random() * 60 + 20; // 20-80px
|
||||
item.style.width = `${size}px`;
|
||||
item.style.height = `${size}px`;
|
||||
|
||||
// 随机颜色
|
||||
const color = colors[Math.floor(Math.random() * colors.length)];
|
||||
item.style.backgroundColor = color;
|
||||
|
||||
// 随机位置,确保在容器内
|
||||
const left = Math.random() * (containerWidth - size);
|
||||
const top = Math.random() * (containerHeight - size - 100) + 50; // 避开底部波浪
|
||||
item.style.left = `${left}px`;
|
||||
item.style.top = `${top}px`;
|
||||
|
||||
// 设置入场动画
|
||||
const appearDuration = Math.random() * 0.5 + 0.5; // 0.5-1s
|
||||
item.style.animation = `appear ${appearDuration}s forwards`;
|
||||
|
||||
container.appendChild(item);
|
||||
|
||||
// 入场动画完成后添加移动动画
|
||||
setTimeout(() => {
|
||||
const moveDuration = Math.random() * 2 + 3; // 3-5s
|
||||
item.style.animation = `appear ${appearDuration}s forwards, move ${moveDuration}s ease-in-out infinite`;
|
||||
}, appearDuration * 1000);
|
||||
|
||||
// 随机时间后移除元素并创建新元素
|
||||
const lifeTime = Math.random() * 5 + 8; // 8-13s
|
||||
setTimeout(() => {
|
||||
// 退场动画
|
||||
item.style.animation = `appear ${appearDuration}s reverse forwards`;
|
||||
setTimeout(() => {
|
||||
container.removeChild(item);
|
||||
// 创建新元素替代
|
||||
createSingleItem();
|
||||
}, appearDuration * 1000);
|
||||
}, lifeTime * 1000);
|
||||
};
|
||||
|
||||
// 初始创建20个元素
|
||||
createAnimatedItems(20);
|
||||
|
||||
// 窗口大小改变时重新计算容器尺寸
|
||||
window.addEventListener('resize', () => {
|
||||
containerWidth = container.offsetWidth;
|
||||
containerHeight = container.offsetHeight;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user