css彩色纸屑动画效果
代码语言:html
所属分类:粒子
代码描述:css彩色纸屑动画效果
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <style> :root { background: #212121; } h1 { text-transform: uppercase; position: fixed; top: 40%; left: 50%; -webkit-transform: translate(-50%, -50%); transform: translate(-50%, -50%); font-size: 15vmax; color: #fff; margin: 0; } h1 i { font-style: normal; position: relative; z-index: -1; } .confettis { position: fixed; top: 83%; left: 50%; -webkit-transform: translate(-50%, -50%) rotate(-180deg); transform: translate(-50%, -50%) rotate(-180deg); -webkit-perspective: 600px; perspective: 600px; -webkit-transform-style: preserve-3d; transform-style: preserve-3d; } svg { position: fixed; fill: #fff; width: 10rem; top: 90%; left: 50%; -webkit-transform: translate(-50%, -50%) rotate(-99deg); transform: translate(-50%, -50%) rotate(-99deg); } .confetti { pointer-events: none; position: absolute; -webkit-transform: rotate(var(--rotation)); transform: rotate(var(--rotation)); } .confetti span { position: absolute; width: .2rem; height: .35rem; will-change: transform; background-color: var(--color); -webkit-animation: fliegen calc(5s * var(--rnd)) infinite cubic-bezier(0.2, 1, 0.2, 1); animation: fliegen calc(5s * var(--rnd)) infinite cubic-bezier(0.2, 1, 0.2, 1); -webkit-animation-delay: -10s; animation-delay: -10s; } @-webkit-keyframes fliegen { 90% { opacity: 1; } 100% { opacity: 0; -webkit-transform: translateY(calc(30vh + 50vh * var(--rnd))) rotateY(calc(3000deg * var(--rnd))) rotateX(calc(2000deg * var(--rnd))) rotateZ(calc(1060deg * var(--rnd))); transform: translateY(calc(30vh + 50vh * var(--rnd))) rotateY(calc(3000deg * var(--rnd))) rotateX(calc(2000deg * var(--rnd))) rotateZ(calc(1060deg * var(--rnd))); } } @keyframes fliegen { 90% { opacity: 1; } 100% { opacity: 0; -webkit-transform: translateY(calc(30vh + 50vh * var(--rnd))) rotateY(calc(3000deg * var(--rnd))) rotateX(calc(2000deg * var(--rnd))) rotateZ(calc(1060deg * var(--rnd))); transform: translateY(calc(30vh + 50vh * var(--rnd))) rotateY(calc(3000deg * var(--rnd))) rotateX(calc(2000deg * var(--rnd))) rotateZ(calc(1060deg * var(--rnd))); } } .........完整代码请登录后点击上方下载按钮下载查看
网友评论0