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 auto 0;
  transition: transform 0.3s;
}

.soup-bowl:hover .mouth {
  transform: scaleY(1.2);
}

@keyframes rainbow {
  0% { background-position: 0 0; }
  50% { background-position: 400% 0; }
  100% { background-position: 0 0; }
}

.title {
  color: #ff6eb4;
  text-align: center;
  margin-bottom: 20px;
  font-size: 2.5rem;
  text-shadow: 3px 3px 0 rgba(255, 255, 255, 0.5);
  animation: bounce 2s ease infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.soup-word {
  display: inline-block;
  transform: rotate(5deg);
  color: #ff4b8d;
  font-family: 'Lobster', cursive;
}

.broth {
  position: relative;
  width: 90%;
  height: 60%;
  background: #ffb347;
  border-radius: 40%;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  overflow: hidden;
  padding: 20px;
  box-sizing: border-box;
  transition: background 0.5s;
  z-index: 3;
}

.letter {
  font-size: 1.5rem;
  font-weight: bold;
  color: #fff;
  margin: 5px;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  transition: transform 0.3s, filter 0.3s;
  position: absolute;
  z-index: 3;
  user-select: none;
}

.letter:hover {
  transform: scale(1.5) rotate(20deg);
  filter: brightness(1.2);
  z-index: 10;
}

.emoji {
  font-size: 1.2rem;
  margin: 0 5px;
  cursor: pointer;
  transition: transform 0.2s;
}

.emoji:hover {
  transform: scale(1.5);
}

.recipe-card {
  background: rgba(255, 255, 255, 0.85);
  padding: 20px;
  border-radius: 20px;
  width: 350px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  border: 3px solid #ffc9e3;
  position: relative;
  overflow: hidden;
}

.recipe-card::before {
  content: '';
  position: absolute;
  top: -10px;
  right: -10px;
  width: 50px;
  height: 50px;
  background: #ff8dc7;
  transform: rotate(45deg);
  z-index: 0;
}

.recipe-card h2 {
  color: #ff6eb4;
  margin-top: 0;
  font-size: 1.8rem;
}

.recipe-card ol {
  text-align: left;
  padding-left: 20px;
}

.recipe-card li {
  margin-bottom: 12px;
  color: #666;
}

.recipe-card i {
  color: #ff8dc7;
  margin-left: 5px;
}

.button-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 15px 0;
}

.kawaii-bt.........完整代码请登录后点击上方下载按钮下载查看

网友评论0