css实现气泡点击爆炸爆破动画效果代码

代码语言:html

所属分类:动画

代码描述:css实现气泡点击爆炸爆破动画效果代码

代码标签: css 气泡 点击 爆炸 爆破 动画

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

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

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

  <link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Bangers&family=Walter+Turncoat&display=swap" rel="stylesheet">
  
  
  
<style>
:root {
  --red: #d52b21;
  --orange: #ffa500;
  --main-bg: #3b3b4f;
  --stroke: #2e2141;
  --polka-dots: var(--stroke);
  --polka-bg: var(--main-bg);
}

html {
  box-sizing: border-box;
}

*,
*::before,
*::after {
  box-sizing: inherit;
  margin: 0;
  padding: 0;
}

body {
  display: flex;
  justify-content: center;
  align-items: center;
  /*   flex-direction: column; */
  flex-wrap: wrap;
  gap: 4rem;
  min-height: 100vh;
  font-family: "Walter Turncoat", cursive;
  color: var(--stroke);
  background-color: var(--polka-bg);
  background-image: radial-gradient(var(--polka-dots) 25%, transparent 25%),
    radial-gradient(var(--polka-dots) 25%, transparent 25%);
  background-size: 20px 20px, 20px 20px;
  background-position: 0 0, 10px 10px;
}

.restart {
  position: fixed;
  top: 2rem;
  left: 2rem;
  display: block;
  min-width: 6rem;
  padding: 0.5rem 1rem 0.7rem;
  font-size: 2rem;
  line-height: 1.2;
  font-family: inherit;
  color: inherit;
  background-color: var(--orange);
  border: 3px solid var(--stroke);
  border-radius: 10px;
  box-shadow: 0.5rem 0.5rem 0 0 var(--red), 0.5rem 0.5rem 0 0.1rem var(--stroke);
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  z-index: 10;
}

.restart::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  display: block;
  width: 0;
  height: 100%;
  background: radial-gradient(closest-side, var(--orange) 50%, transparent),
    repeating-conic-gradient(var(--red) 0 4%, var(--orange) 0 8%);
  border-radius: 7px;
  transform: translate(-50%, -50%);
  transition: all 0.3s ease-out;
  opacity: 0;
  z-index: -1;
}

.restart:active::before,
.restart:focus::before {
  width: 100%;
  box-shadow: 0 0 0 0 var(--red), 0 0 0 0 var(--stroke);
  opacity: 1;
}

.restart:hover {
  box-shadow: 0 0 0 0 var(--red), 0 0 0 0 var(--stroke);
}

.bubble {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  font-size: 32px;
  width: 5em;
  height: 5em;
  border-radius: 50%;
  animation: floating 3s ease-in-out infinite;
  overflow: hidden;
  cursor: pointer;
}

.bubble__main {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background-color: var(--orange);
  border: 0.1em solid var(--stroke);
  border-right-width: 0.2em;
  transition: all 0.1s ease-in-out;
}

.bubble__main::before {
  content: "";
  position: absolute;
  top: 0.5em;
  left: 0.5em;
  display: block;
  width: 2em;
  height: 2.5em;
  border-radius: 50%;
  border-left: 0.2em solid var(--stroke);
  transform: rotate(40deg);
}

.bubble__drop {
  position: absolute;
  top: 50%;
  left: 50%;
  translate: -50% -50%;
  width: 2em;
  height: 0.125em;
  background-color: orange;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease-in-out;
  z-index: 1;
}

.bubble__drop--1,
.bubble__drop--3 {
  transform: rotate(90deg);
}

.bubble__drop--5,
.bubble__drop--7 {
  transform: rotate(-45deg);
}

.bubble__drop--6,
.bubble__drop--8 {
  transform: rotate(45deg);
}

.bubble--2 {
  font-size: 28px;
  animation-delay: 1.5s;
  overflow: visible;
  .bubble__main {
    background-color: var(--red);
  }
}

.bubble__flash {
  position: absolute;
  margin-top: 30px;
  opacity: 0;
  visibility: hidden;
  z-index: -1;
}

.bubble__flash-layer {
  position: absolu.........完整代码请登录后点击上方下载按钮下载查看

网友评论0