css布局实现三维质感文字旋转动画效果代码
代码语言:html
所属分类:布局界面
代码描述:css布局实现三维质感文字旋转动画效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <style> @import url("https://fonts.googleapis.com/css2?family=Philosopher:ital,wght@1,700&display=swap"); *, *::before, *::after { padding: 0; margin: 0 auto; box-sizing: border-box; } body { font-family: "Philosopher", sans-serif; background-color: #000; min-height: 100vh; display: grid; place-items: center; perspective: 750px; overflow: hidden; } .threeK { position: relative; transform-style: preserve-3d; width: 1080px; height: 720px; background-image: radial-gradient(#eee, #111); -webkit-animation: moveX 10s ease-in-out infinite alternate; animation: moveX 10s ease-in-out infinite alternate; } @-webkit-keyframes moveX { from { transform: rotateX(45deg) rotate(30deg); } to { transform: rotateX(45deg) rotate(-30deg); } } @keyframes moveX { from { transform: rotateX(45deg) rotate(30deg); } to { transform: rotateX(45deg) rotate(-30deg); } } .layer { transform: translateZ(var(--tz, 0)); } .layer::before { content: "3K"; top: 80px; font-size: 420px; } .layer::after { content: "Followers"; top: 460px; font-size: 120px; } .layer::before, .layer::after { position: absolute; width: 100%; text-align: center; color: hsl(0, 0%, var(--light, 0)); } .layer:nth-child(1) { --tz: 0px; --light: 30%; } .layer:nth-child(2) { --tz: 0px; --light: 32%; } .layer:nth-child(3) { --tz: 1px; --light: 34%; } .layer:nth-child(4) { --tz: 2px; --light: 36%; } .layer:nth-child(5) { --tz: 3px; --light: 38%; } .layer:nth-child(6) { --tz: 4px; --light: 40%; } .layer:nth-child(7) { --tz: 5px; --light: 42%; } .layer:nth-child(8) { --tz: 6px; --light: 44%; } .layer:nth-child(9) { --tz: 7px; --light: 46%; } .layer:nth-child(10) { --tz: 8px; --light: 48%; } .layer:nth-child(11) { --tz: 9px; --light: 50%; } .layer:nth-child(12) { --tz: 10px; --light: 52%; } .layer:nth-child(13) { --tz: 11px; --light: 54%; } .layer:nth-child(14) { --tz: 12px; --light: 56%; } .layer:nth-child(15) { --tz: 13px; --light: 58%; } .layer:nth-child(16) { --tz: 14px; --light: 60%; } .layer:nth-child(17) { --tz: 15px; --light: 62%; } .layer:nth-child(18) { --tz: 16px; --light: 64%; } .layer:nth-child(19) { --tz: 17.........完整代码请登录后点击上方下载按钮下载查看
网友评论0