css实现翻书气球上升生日快乐动画效果代码

代码语言:html

所属分类:动画

代码描述:css实现翻书气球上升生日快乐动画效果代码

代码标签: css 翻书 气球 上升 生日 快乐 动画

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

<!DOCTYPE html>
<html lang="en" >
<head>
  <meta charset="UTF-8">

<link
      href="https://fonts.googleapis.com/css2?family=Luckiest+Guy&display=swap"
      rel="stylesheet"
    />
<style>
    *,
      :before,
      :after {
        margin: 0;
        padding: 0;
        box-sizing: border-box;
      }

      body {
        height: 100vh;
        display: flex;
        justify-content: center;
        align-items: center;
        overflow: hidden;
        background: #fee5ac;
      }

      .container {
        position: relative;
        width: 90%;
        max-width: 800px;
        height: 600px;
        perspective: 1000px;
        transform-style: preserve-3d;
      }

      .side {
        position: absolute;
        width: 40%;
        height: 85%;
        top: 50%;
        background-color: #9ee0a1;
        border: 1px solid rgba(170, 170, 170, 0.644);
      }

      .left-side {
        right: 50%;

        transform-origin: 100% 50%;
        animation: leftSideOpen 2s ease-in-out 1;
        animation-fill-mode: forwards;
        box-shadow: -2em 0 5em #6fbe73 inset, -1em 0 1em #7bc07f inset,
          0 5px 10px #2e2d2d73;
      }

      .right-side {
        left: 50%;

        transform-origin: 0% 50%;
        animation: rightSideOpen 2s ease-in-out 1;
        animation-fill-mode: forwards;
        box-shadow: 2em 0 5em #6fbe73 inset, 1em 0 1em #7bc07f inset,
          0 5px 10px #2e2d2d73;
      }

      .birthday-text {
        position: absolute;
        font-family: "Luckiest Guy", cursive;
        font-size: 6rem;
        text-align: center;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 0;
        color: #fee5ac;
        text-shadow: 0 0 10px #aaa;
        animation: showText 2s ease-in-out 250ms 1;
        animation-fill-mode: forwards;
        overflow: hidden;
        user-select: none;
      }

      @keyframes leftSideOpen {
        0% {
          transform: translateZ(-300px) translateY(-50%) rotateY(90deg);
        }

        100% {
          transform: translateZ(-300px) translateY(-50%) rotateY(30deg);
        }
      }

      @keyframes rightSideOpen {
        0% {
          transform: translateZ(-300px) translateY(-50%) rotateY(-90deg);
        }

        100% {
          transform: translateZ(-300px) translateY(-50%) rotateY(-30deg);
        }
      }

      @keyframes showText {
        0% {
          width: 0;
        }

        100% {
          width: 100%;
        }
      }

      .balloon {
        position: absolute;
        width: 3.5em;
        height: 5em;
        border-radius: 50%;
        opacity: 0;
        animation: floatUp 3s ease-in 1s 1;
        animation-fill-mode: forwards;
      }

      .balloon::before {
        content: "";
        position: absolute;
        width: 1em;
        height: 1em;
        clip-path.........完整代码请登录后点击上方下载按钮下载查看

网友评论0