gsap文字上蹿下跳动画效果
代码语言:html
所属分类:动画
代码描述:gsap文字上蹿下跳动画效果
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <style> @import url("https://fonts.googleapis.com/css?family=Bebas+Neue&display=swap"); :root { --animation-duration: 2400ms; --animation-timing-function: ease-in-out; --animation-iteration-count: infinite; --bg-color: #f378c7; } * { box-sizing: border-box; margin: 0; padding: 0; } body { width: 100%; height: 100vh; background-color: var(--bg-color); display: flex; flex-direction: column; justify-content: center; align-items: center; overflow: hidden; } .icons { display: none; } .container { position: relative; width: 400px; height: 260px; } .container--1 { --delay-offset: -1000ms; } .container--1 .text .char-container:nth-child(1) .icon { top: 50%; left: 10%; } .container--1 .text .char-container:nth-child(5) .icon { top: 15%; left: 50%; } .container--2 { --delay-offset: -2000ms; } .container--2 .text .char-container:nth-child(2) .icon { top: 60%; left: 10%; } .container--2 .text .char-container:nth-child(4) .icon { top: 75%; left: 80%; } .container .text-container, .container .shadow-container { position: absolute; top: 0; left: 0; width: 100%; height: 100%; } .container .text { position: absolute; top: 50%; display: flex; font-size: 12rem; font-family: "Bebas Neue"; font-weight: bold; letter-spacing: 5px; -webkit-text-stroke: 2px #161618; user-select: none; pointer-events: none; } .container .text .char-container { position: relative; } .container .text .icon { position: absolute; width: 1rem; height: 1rem; stroke-width: 25px; stroke: #161618; transform: translate(-50%, -50%); animation: scaleUpdown var(--animation-duration) var(--animation-timing-function) var(--animation-iteration-count); animation-delay: var(--icon-animation-delay); } .container .text-container { z-index: 1; } .container .text-container .text { transform: translate(-50%, -50%); animation: upDown var(--animation-duration) var(--animation-timing-function) var(--animation-iteration-count); } .container .text-container .text .icon { fill: #f2f2f2; } .container .text-container .text:nth-child(1) { left: 45.5%; animation-delay: calc(var(--delay-offset) + (0.1s * 1)); z-index: -1; } .container .text-container .text:nth-child(2) { left: 46%; animation-delay: calc(var(--delay-offset) + (0.1s * 2)); z-index: -2; } .container .text-container .text:nth-child(3) { left: 46.5%; animation-delay: calc(var(--delay-offset) + (0.1s * 3)); z-index: -3; } .container .text-container .text:nth-child(4) { left: 47%; animation-delay: calc(var(--delay-offset) + (0.1s * 4)); z-index: -4; } .container .shadow-container { z-index: 0; } .container .shadow-container .text { -webkit-text-stroke: 0; color: #e900a3; top: 53%; } .container .shadow-container .text:nth-child(1) { opacity: 0; left: 47.5%; transform: translate(-50%, -50%); } .container .shadow-container .text:nth-child(2) { opacity: 0; left: 48%; transform: translate(-50%, -50%); } .container .shadow-container .text:nth-child(3) { opacity: 0; left: 48.5%; transform: translate(-50%, -50%); } .container .shadow-container .text:nth-child(4) { opacity: 0; left: 49%; transform: translate(-50%, -50%); } .container .shadow-container .text .icon { fill: #e900a3; stroke-width: 0; } @keyframes upDown { 0%, 100% { opacity: 1; transform: translate(-50%, -70%); } 50% { transform: translate(-50%, -30%); } } @keyframes scaleUpdown { 0% { transform: translate(-50%, -50%) scale(1) rotate(0); } 50% { transform: translate(-50%, -50%) scale(1.5) rotate(90deg); } 100% { transform: translate(-50%, -50%) scale(1) rotate(180deg); } } .support { position: absolute; right: 10px; bottom: 10px; padding: 10px; display: flex; } .support a { margin: 0 10px; color: #f2f2f2; font-size: 1.8rem; backface-visibility: hidden; transition: all 150ms ease; } .support a:hover { transform: scale(1.1); } </style> </head> <body translate="no&qu.........完整代码请登录后点击上方下载按钮下载查看
网友评论0