css实现点击碎纸削礼花喷射动画效果代码
代码语言:html
所属分类:动画
代码描述:css实现点击碎纸削礼花喷射动画效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<style>
body {
font-family: system-ui;
margin: 0;
min-block-size: 100vh;
display: grid;
place-content: center;
background-color: #100722;
overflow: hidden;
perspective: 1000px;
--preloadDuration: 0s;
-webkit-animation: preloadAnimation 1ms 10s forwards;
animation: preloadAnimation 1ms 10s forwards;
}
@-webkit-keyframes preloadAnimation {
to {
--preloadDuration: unset;
}
}
@keyframes preloadAnimation {
to {
--preloadDuration: unset;
}
}
.party {
position: relative;
font-size: 2rem;
color: white;
background-color: #6930f8;
background-image: radial-gradient(#975df4, transparent 75%);
background-repeat: no-repeat;
background-position: 0 100px;
padding: 1rem 2rem;
border: 0;
border-radius: 100vw;
cursor: pointer;
transition: background-position 200ms;
transform-style: preserve-3d;
}
.party:hover, .party:focus {
background-position: 0 35px;
}
.confetti {
position: absolute;
inset: 50%;
transform-style: preserve-3d;
opacity: 0;
}
.confetti > span {
position: absolute;
width: 25px;
aspect-ratio: 1;
background-color: hsl(var(--hue), 100%, 50%);
border-radius: var(--shape);
width: max(5px, var(--confetti-size));
}
.confetti > span:nth-child(1) {
--shape: -47.5117859241vw;
--confetti-size: 8px;
--hue: 134;
--offsetY: 7.5vh;
--offsetX: -12vw;
--offsetZ: 8px;
--spin: 5turn;
}
.confetti > span:nth-child(2) {
--shape: 16.3798350804vw;
--confetti-size: 8px;
--hue: -4;
--offsetY: 15.5vh;
--offsetX: -40vw;
--offsetZ: 125px;
--spin: 6turn;
}
.confetti > span:nth-child(3) {
--shape: -38.3305327697vw;
--confetti-size: 12px;
--hue: 80;
--offsetY: -12.5vh;
--offsetX: 5vw;
--offsetZ: -80px;
--spin: 2turn;
}
.confetti > span:nth-child(4) {
--shape: -35.6396462154vw;
--confetti-size: 12px;
--hue: 2;
--offsetY: 9.5vh;
--offsetX: -34vw;
--offsetZ: -196px;
--spin: 5turn;
}
.confetti > span:nth-child(5) {
--shape: -17.9618381513vw;
--confetti-size: 5px;
--hue: -160;
--offsetY: -2.5vh;
--offsetX: -32vw;
--offsetZ: 57px;
--spin: 8turn;
}
.confetti > span:nth-child(6) {
--shape: 9.5846307919vw;
--confetti-size: 7px.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0