gsap+confetti实现数字增长跳动到最后纸屑喷射动画效果代码

代码语言:html

所属分类:动画

代码描述:gsap+confetti实现数字增长跳动到最后纸屑喷射动画效果代码

代码标签: gsap confetti 数字 增长 跳动 纸屑 喷射 动画

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


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

<head>

  <meta charset="UTF-8">
  

  <meta name="viewport" content="width=device-width, initial-scale=1">


  
  
<style>
@import url("https://fonts.googleapis.com/css2?family=Roboto+Flex:opsz,wght@8..144,100&display=swap");

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  --c1: #fbda61;
  --c2: #ff5acd;
  display: grid;
  place-items: center;
  place-content: center;
  gap: 2rem;
  font-family: "Roboto Flex", sans-serif;
}

.counter {
  position: relative;
  font-size: max(2rem, 1rem + 12vw);
  font-variation-settings: "wght" var(--font-variation-weight, 600);
}

.celebrate {
  color: transparent;
  -webkit-background-clip: text;
          background-clip: text;
  background-color: #4158d0;
  background-image: linear-gradient(45deg, var(--c2), var(--c1), var(--c2));
  background-size: 200% auto;
  filter: drop-shadow(white 1px 1px 0) drop-shadow(#fbda61 2px 2px 2px);
  -webkit-animation: bg 4s cubic-bezier(0.25, 1, 0.5, 1) forwards;
          animation: bg 4s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

@media (prefers-reduced-motion) {
  .celebrate {
    -webkit-animation: unset;
            animation: unset;
  }
}

@-webkit-keyframes bg {
  100% {
    background-position: 200% center;
  }
}

@keyframes bg {
  100% {
    background-position: 200% center;
  }
}

.btn-restart {
  cursor: pointer;
  font: inherit;
  font-size: 1.25rem;
  font-variation-settings: "wght" 400;
  padding: 0.5rem 2rem;
  color: darkslateblue;
  background: papayawhip;
  border: 2px solid currentcolor;
  box-shadow: inset white 0 0 0 2px;
  border-radius: 0.15rem;
}

.btn-restart:active {
  transform: translateY(1px);
}

.btn-restart:focus-visible {
  outline-offset: 4px;
}

.btn-restart:focus-visible,
.btn-restart:active {
  color: black;
  background-color: #f4e4ca;
}
</style>




</head>

<body >
  <h1 class="counter" data-count-start="1,000">5,000,000<.........完整代码请登录后点击上方下载按钮下载查看

网友评论0