js+css实现带音效可爱文字汤碗效果代码

代码语言:html

所属分类:其他

代码描述:js+css实现带音效可爱文字汤碗效果代码

代码标签: js css 音效 可爱 文字 汤碗

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en" >

<head>
  <meta charset="UTF-8">
  

  
<style>
body {
  margin: 0;
  padding: 0;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: #fae1f6;
  font-family: 'Comic Neue', cursive;
  overflow: hidden;
  transition: background-color 1s ease;
}

.kitchen {
  position: relative;
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  gap: 40px;
  width: 90%;
  max-width: 1200px;
  padding: 20px;
}

/* Kawaii Elements */
.kawaii-elements {
  position: absolute;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.kawaii-cloud, .kawaii-star, .kawaii-heart {
  position: absolute;
  font-size: 2rem;
  opacity: 0.6;
  animation: float-around 15s ease-in-out infinite;
}

.kawaii-cloud {
  color: #c2e8ff;
}

.kawaii-star {
  color: #ffffa1;
}

.kawaii-heart {
  color: #ffb1d8;
}

.cloud1 {
  top: 10%;
  left: 5%;
  font-size: 3rem;
  animation-delay: 0s;
}

.cloud2 {
  top: 15%;
  right: 10%;
  font-size: 2.5rem;
  animation-delay: 3s;
}

.star1 {
  bottom: 15%;
  left: 20%;
  animation-delay: 2s;
}

.star2 {
  top: 25%;
  right: 25%;
  animation-delay: 5s;
}

.kawaii-heart {
  bottom: 10%;
  right: 15%;
  animation-delay: 1s;
}

@keyframes float-around {
  0%, 100% {
    transform: translateY(0) rotate(0deg);
  }
  25% {
    transform: translateY(-20px) rotate(5deg);
  }
  50% {
    transform: translateY(0) rotate(0deg);
  }
  75% {
    transform: translateY(20px) rotate(-5deg);
  }
}

/* Soup Bowl Styles */
.soup-bowl {
  position: relative;
  width: 400px;
  height: 400px;
  background: #ffffff;
  border-radius: 50% 50% 45% 45%;
  box-shadow: 
    inset 0 0 50px rgba(0, 0, 0, 0.1),
    0 20px 50px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 30px;
  box-sizing: border-box;
  z-index: 2;
  transition: transform 0.3s;
}

.soup-bowl:hover {
  transform: translateY(-10px) scale(1.02);
}

.soup-bowl::before {
  content: '';
  position: absolute;
  top: -10px;
  left: -10px;
  right: -10px;
  bottom: -10px;
  background: linear-gradient(45deg, #ffb1d8, #ffc5e9, #e6f7ff, #d6f5ff);
  background-size: 400%;
  border-radius: 50%;
  opacity: 0;
  z-index: -1;
  filter: blur(20px);
  animation: rainbow 8s linear infinite;
  transition: opacity 0.3s;
}

.soup-bowl:hover::before {
  opacity: 0.3;
}

.bowl-rim {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 15px solid #f3f3f3;
  border-radius: 50%;
  box-sizing: border-box;
  pointer-events: none;
}

/* Kawaii Face */
.bowl-face {
  position: absolute;
  bottom: 70px;
  width: 80px;
  height: 40px;
  z-index: 4;
  transition: opacity 0.5s;
  opacity: 0;
}

.soup-bowl:hover .bowl-face {
  opacity: 1;
}

.eyes {
  display: flex;
  justify-content: space-between;
  width: 100%;
}

.eye {
  width: 12px;
  height: 20px;
  background-color: #333;
  border-radius: 50%;
  position: relative;
}

.eye::after {
  content: '';
  position: absolute;
  width: 4px;
  height: 4px;
  background-color: white;
  border-radius: 50%;
  top: 3px;
  left: 3px;
}

.mouth {
  width: 30px;
  height: 15px;
  border-radius: 0 0 15px 15px;
  background-color: #333;
  margin: 5px a.........完整代码请登录后点击上方下载按钮下载查看

网友评论0