div+css实现三维地铁车厢效果代码
代码语言:html
所属分类:三维
代码描述:div+css实现三维地铁车厢效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <link rel='stylesheet' href='https://fonts.googleapis.com/css2?family=Barlow+Semi+Condensed:wght@100&display=swap'> <style> body { background: #000; } .train-art { transform: translate(-250px, -100px); } .background-section .sky { top: -300px; left: -1000px; width: 2500px; height: 800px; background: linear-gradient(to bottom, #FFC371, #FF5F6D); transform: translate3d(0, 0, -500px); } .background-section .sun { width: 50px; height: 50px; background: #ff0; border-radius: 100%; transform: translate3d(250px, -50px, -500px); filter: drop-shadow(0 0 20px #ff0) blur(2px); } .background-section .pole { top: -300px; width: 20px; height: 800px; background: linear-gradient(90deg, #444, #000); transform: translate3d(0, 0, -200px); -webkit-animation: pole 2000ms linear infinite; animation: pole 2000ms linear infinite; } @-webkit-keyframes pole { 0% { transform: translate3d(-500px, 0, -200px); } 50% { transform: translate3d(1000px, 0, -200px); } 100% { transform: translate3d(1000px, 0, -200px); } } @keyframes pole { 0% { transform: translate3d(-500px, 0, -200px); } 50% { transform: translate3d(1000px, 0, -200px); } 100% { transform: translate3d(1000px, 0, -200px); } } .back-section .screen { background: #000; } .back-section .screen.-top { left: -500px; top: -500px; width: 1500px; height: 500px; transform: translate3d(0, 0, -110px); } .back-section .screen.-bottom { left: -500px; top: 200px; width: 1500px; height: 500px; transform: translate3d(0, 0, -110px); } .back-section .screen.-left { left: -500px; top: -500px; width: 500px; height: 1200px; transform: translate3d(0, 0, -110px); } .back-section .screen.-right { left: 500px; top: -500px; width: 500px; height: 1200px; transform: translate3d(0, 0, -110px); } .back-section .body .panel { -webkit-backface-visibility: hidden; backface-visibility: hidden; } .back-section .body .panel.-top { width: 500px; height: 40px; background: #e7e3d9; transform: translateZ(-100px); } .back-section .body .panel.-windowleft { width: 70px; height: 200px; background: #e7e3d9; transform: translate3d(150px, 0, -100px); } .back-section .body .panel.-windowright { width: 40px; height: 200px; background: #e7e3d9; transform: translate3d(460px, 0, -100px); } .back-section .body .panel.-windowbottom { width: 330px; height: 80px; background: #e7e3d9; transform: translate3d(170px, 120px, -100px); } .back-section .body .panel.-doorleft { width: 30px; height: 200px; background: #e7e3d9; transform: translate3d(0, 0, -100px); } .back-section .body .panel.-bottomleft { width: 30px; height: 10px; background: #c3bca6; transform: translate3d(0, 195px, -105px) rotateX(-90deg); } .back-section .body .panel.-bottomright { width: 350px; height: 10px; background: #c3bca6; transform: translate3d(150px, 195px, -105px) rotateX(-90deg); } .back-section .body .windowthickness { -webkit-backface-visibility: hidden; backface-visibility: hidden; } .back-section .body .windowthickness.-top { width: 240px; height: 10px; background: #b8b2a4; transform: translate3d(220px, 35px, -105px) rotateX(-90deg); } .back-section .body .windowthickness.-bottom { width: 240px; height: 10px; background: #f2ecdd; transform: translate3d(220px, 115px, -105px) rotateX(90deg); } .back-section .body .windowthickness.-left { width: 10px; height: 80px; background: #d7cfbe; transform: translate3d(215px, 40px, -105px) rotateY(90deg); } .back-section .body .windowthickness.-right { width: 10px; height: 80px; background: #d7cfbe; transform: translate3d(455px, 40px, -105px) rotateY(-90deg); } .back-section .body .bodythickness { -webkit-backface-visibility: hidden; backface-visibility: hidden; } .back-section .body .bodythickness.-left { width: 10px; height: 200px; background: #d7cfbe; transform: translate3d(-5px, 0, -105px) rotateY(-90deg); } .back-section .body .bodythickness.-right { width: 10px; height: 200px; background: #d7cfbe; transform: translate3d(495px, 0, -105px) rotateY(90deg); } .back-section .door.-left { transform: translate3d(30px, 40px, -100px); } .back-section .door.-right { transform: translate3d(90px, 40px, -100px); } .back-section .door .panel { background: #ccc; background: linear-gradient(180deg, #c0c0c0 0, #f2f2f2 60px, #c0c0c0 120px); -webkit-backface-visibility: hidden; backface-visibility: hidden; } .back-section .door .panel.-top { width: 60px; height: 10px; } .back-section .door .panel.-left { width: 10px; height: 160px; } .back-section .door .panel.-right { width: 10px; height: 160px; transform: translateX(50px); } .back-section .door .panel.-bottom { width: 60px; height: 160px; -webkit-clip-path: polygon(0 80px, 100% 80px, 100% 105%, 0 105%); clip-path: polygon(0 80px, 100% 80px, 100% 105%, 0 105%); } .back-section .door .panel.-doorbottom { width: 60px; height: 4px; background: #999; transform: translate3d(0, 158px, -2px) rotateX(-90deg); } .back-section .door .thickness { -webkit-backface-visibility: hidden; backface-visibility: hidden; } .back-section .door .thickness.-top { width: 40px; height: 4px; background: #888; transform: translate3d(10px, 8px, -2px) rotateX(-90deg); } .back-section .door .thickness.-bottom { width: 40px; height: 4px; background: #ddd; transform: translate3d(10px, 78px, -2px) rotateX(90deg); } .back-section .door .thickness.-left { width: 4px; height: 70px; background: #aaa; transform: translate3d(8px, 10px, -2px) rotateY(90deg); } .back-section .door .thickness.-right { width: 4px; height: 70px; background: #aaa; transform: translate3d(48px, 10px, -2px) rotateY(-90deg); } .back-section .doors { transform: translate3d(0, 0, -2px); } .back-section .doorpocket.-top { width: 120px; height: 10px; background: #3b3a36; transform: translate3d(30px, 35px, -105px) rotateX(-90deg); -webkit-backface-visibility: hidden; backface-visibility: hidden; } .back-section .doorpocket.-bottom { width: 120px; height: 10px; background: #3b3a36; transform: translate3d(30px, 195px, -105px) rotateX(90deg); } .back-section .doorpocket.-left { width: 10px; height: 160px; background: #65625a; transform: translate3d(25px, 40px, -105px) rotateY(90deg); -webkit-backface-visibility: hidden; backface-visibility: hidden; } .back-section .doorpocket.-right { width: 10px; height: 160px; background: #65625a; transform: translate3d(145px, 40px, -105px) rotateY(-90deg); -webkit-backface-visibility: hidden; backface-visibility: hidden; } .floor-section .panel { width: 500px; height: 140px; background: repeating-radial-gradient(ellipse at right top, rgba(255, 255, 255, 0) 0, rgba(255, 255, 255, 0.02) 10px), linear-gradient(0deg, #c1c2c6, #a2a29e); transform: translate3d(0px, 130px, -30px) rotateX(90deg); -webkit-backface-visibility: hidden; backface-visibility: hidden; } .ceiling-section .panel { width: 500px; height: 140px; background: linear-gradient(0deg, #afaca4, #bebbb5); transform: translate3d(0px, -70px, -30px) rotateX(-90deg); -webkit-backface-visibility: hidden; backface-visibility: hidden; } .seat-section .cussion { -webkit-backface-visibility: hidden; backface-visibility: hidden; } .seat-section .cussion.-back { width: 320px; height: 44px; background: linear-gradient(180deg, #26294f 0%, rgba(81, 99, 166, 0) 50%, rgba(81, 99, 166, 0.5) 100%), repeating-linear-gradient(90deg, #313a65 0, #26294f 10px, #26294f 30px, #313a65 40px); transform: translate3d(180px, 129.7px, -87px) rotateX(10deg); } .seat-section .cussion.-backtop { width: 320px; height: 10px; background: #2c2f57; transform: translate3d(180px, 125px, -95px) rotateX(90deg); } .seat-section .cussion.-top { width: 320px; height: 40px; background: linear-gradient(180deg, #26294f 0%, rgba(81, 99, 166, 0) 50%, rgba(81, 99, 166, 0.5) 100%), repeating-linear-gradient(90deg, #313a65 0, #26294f 10px, #26294f 30px, #313a65 40px); transform: translate3d(180px, 150px, -65px) rotateX(90deg); } .seat-section .cussion.-front { width: 320px; height: 10px; background: linear-gradient(0deg, rgba(81, 99, 166, 0) 50%, rgba(81, 99, 166, 0.5) 100%), repeating-linear-gradient(90deg, #313a65 0, #26294f 10px, #26294f 30px, #313a65 40px); transform: translate3d(180px, 170px, -45px); } .seat-section .cussion.-bottom { width: 320px; height: 10px; background: #00a; transform: translate3d(180px, 175px, -50px) rotateX(-90deg); } .seat-section .mecha.-front { width: 320px; height: 22.3px; background: repeating-linear-gradient(90deg, #666 0, #666 1px, rgba(0, 0, 0, 0) 1.1px, rgba(0, 0, 0, 0) 1.3px), repeating-linear-gradient(0deg, #666 0, #666 1px, #000 2px, #000 3px); transform: translate3d(180px, 179px, -59px) rotateX(-22deg); -webkit-backface-visibility: hidden; backface-visibility: hidden; border: 3px solid #666; box-sizing: border-box; } .seat-section .mecha.-front::after { content: ""; position: absolute; top: -3px; left: -3px; width: calc(100% + 6px); height: calc(100% + 6px); background: linear-gradient(0deg, rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0) 60%); } .seat-section .mecha.-front::before { content: ""; position: absolute; left: calc(50% - 3px); width: 6px; height: 100%; background: #666; } .seat-section .mecha.-bottom { width: 320px; height: 37px; background: #222; transform: translate3d(180px, 181.6px, -82px) rotateX(-90deg); -webkit-backface-visibility: hidden; backface-visibility: hidden; } .seat-section .shadow { width: 320px; height: 30px; background: linear-gradient(0deg, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.3)); transform: translate3d(180px, 185px, -50px) rotateX(90deg); -webkit-backface-visibility: hidden; backface-visibility: hidden; } .seat-section .side { width: 60px; height: 100px; background: radial-gradient(ellipse at left top, white, #cccccc); border-radius: 80% 0 0 0; } .seat-section .side.-left { transform: translate3d(150px, 100px, -70px) rotateY(90deg); } .seat-section .side.-right { transform: translate3d(470px, 100px, -70px) rotateY(90deg); } .info-section .panel { -webkit-backface-visibility: hidden; backface-visibility: hidden; } .info-section .panel.-top { width: 500px; height: 31px; background: #fff; transform: translate3d(0, -15.5px, -94.4px) rotateX(90deg); } .info-section .panel.-front { width: 500px; height: 30px; background: linear-gradient(0deg, #d1cdc4, #bfbbb2); transform: translate3d(0, -4.5px, -89.4px) rotateX(-45deg); } .info-section .panel.-left { width: 21px; height: 21.5px; background: #d7cfbe; -webkit-clip-path: polygon(0 0, 100% 0, 0 100%); clip-path: polygon(0 0, 100% 0, 0 100%); transform: translate3d(-10.5px, 0, -90px) rotateY(-90deg); } .info-section .panel.-right { width: 21px; height: 21.5px; background: #d7cfbe; -webkit-clip-path: polygon(0 0, 100% 0, 100% 100%); clip-path: polygon(0 0, 100% 0, 100% 100%); transform: translate3d(489.5px, 0, -90px) rotateY(90deg); } .shelf-section .pillar { width: 4px; height: 110px; background-image: linear-gradient(0deg, #555555, rgba(85, 85, 85, 0)), linear-gradient(90deg, #555, #fff); border-radius: 99px; } .shelf-section .pillar.-left { transform: translate3d(178px, 34px, -45px) rotateY(90deg) rotateZ(10deg); } .shelf-section .pillar.-right { transform: translate3d(498px, 34px, -45px) rotateY(90deg) rotateZ(10deg); } .shelf-section .pillar::before { content: ""; position: absolute; bottom: -12px; width: 100%; height: 15px; border-radius: 99px; background: #555; transform-origin: 50% 2px; transform: rotateZ(-50deg); } .shelf-section .pillar.-center { height: 145px; transform: translate3d(338px, 34px, -42px) rotateY(90deg) rotateZ(10deg); } .shelf-section .pillar.-center::before { bottom: -37px; height: 40px; transform: rotateZ(-80deg); } .shelf-section .line { width: 320px; height: 3px; background: linear-gradient(0deg, #555, #fff); } .shelf-section .line.-line1 { transform: translate3d(180px, 35px, -55px); } .shelf-section .line.-line2 { transform: translate3d(180px, 35px, -63px); } .shelf-section .line.-line3 { transform: translate3d(180px, 35px, -71px); } .shelf-section .line.-line4 { transform: translate3d(180px, 35px, -79px); } .shelf-section .line.-line5 { transform: translate3d(180px, 35px, -88px); } .shelf-section .line.-line6 { transform: translate3d(180px, 35px, -87px); } .shelf-section .arm { width: 50px; height: 3px; background: linear-gradient(0deg, #555, #fff); } .shelf-section .arm.-left { transform: translate3d(155px, 35px, -80px) rotateY(90deg); } .shelf-section .arm.-right { transform: translate3d(475px, 35px, -80px) rotateY(90deg); } .shelf-section .arm.-center { transform: translate3d(312px, 35px, -80px) rotateY(90deg); } .strap-section .arm { width: 500px; height: 3px; background: linear-gradient(0deg, #555, #fff); transform: translate3d(0, 15px, -20px); } .strap-section .pillar { width: 3px; height: 15px; background: linear-gradient(-90deg, #555, #fff); } .strap-section .pillar.-pillar1 { transform: translate3d(10px, 0, -20px); } .strap-section .pillar.-pillar2 { transform: translate3d(110px, 0, -20px); } .strap-section .pillar.-pillar3 { transform: translate3d(210px, 0, -20px); } .strap-section .pillar.-pillar4 { transform: translate3d(310px, 0, -20px); } .strap-section .pillar.-pillar5 { transform: translate3d(410px, 0, -20px); } .strap-section .pillar::before { content: ""; position: absolute; width: 5px; height: 5px; background: #888; border-radius: 100%; transform: translate3d(-1px, -2.5px, 0) rotateX(90deg); } .strap-section .joint { width: 3px; height: 5px; border: 1px solid #ccc; border-radius: 100% 100% 0 0; } .strap-section .belt { width: 5px; height: 10px; background: linear-gradient(0deg, #ccc, #eee); transform: translate3d(0, 6px, 0); } .strap-section .handle { width: 9px; height: 9px; border: 2px solid #fff; border-radius: 100%; transform: translate3d(-4px, 15px, 0); } .strap-section .handle::before { content: ""; position: absolute; top: -2px; left: -2px; width: calc(100% + 4px); height: calc(100% + 4px); border-radius: 100%; border: 2px double rgba(0, 0, 0, 0.1); box-sizing: border-box; } .strap-section .strap:nth-child(1) { transform: translate3d(25px, 14px, -17px) rotateY(90deg); } .strap-section .strap:nth-child(1) .shake { -webkit-animation-delay: -93ms; animation-delay: -93ms; } .strap-section .strap:nth-child(2) { transform: translate3d(55px, 14px, -17px) rotateY(90deg); } .strap-section .strap:nth-child(2) .shake { -webkit-animation-delay: -60ms; animation-delay: -60ms; } .strap-section .strap:nth-child(3) { transform: translate3d(85px, 14px, -17px) rotateY(90deg); } .strap-section .strap:nth-child(3) .shake { -webkit-animation-delay: -84ms; animation-delay: -84ms; } .strap-section .strap:nth-child(4) { transform: translate3d(115px, 14px, -17px) rotateY(90deg); } .strap-section .strap:nth-child(4) .shake { -webkit-animation-delay: -43ms; animation-delay: -43ms; } .strap-section .strap:nth-child(5) { transform: translate3d(145px, 14px, -17px) rotateY(90deg); } .strap-section .strap:nth-child(5) .shake { -webkit-animation-delay: -68ms; animation-delay: -68ms; } .strap-section .strap:nth-child(6) { transform: translate3d(175px, 14px, -17px) rotateY(90deg); } .strap-section .strap:nth-child(6) .shake { -webkit-animation-delay: -41ms; animation-delay: -41ms; } .strap-section .strap:nth-child(7) { transform: translate3d(205px, 14px, -17px) rotateY(90deg); } .strap-section .strap:nth-child(7) .shake { -webkit-animation-delay: -71ms; animation-delay: -71ms; } .strap-section .strap:nth-child(8) { transform: translate3d(235px, 14px, -17px) rotateY(90deg); } .strap-section .strap:nth-child(8) .shake { -webkit-animation-delay: -94ms; animation-delay: -94ms; } .strap-section .strap:nth-child(9) { transform: translate3d(265px, 14px, -17px) rotateY(90deg); } .strap-section .strap:nth-child(9) .shake { -webkit-animation-delay: -38ms; animation-delay: -38ms; } .strap-section .strap:nth-child(10) { transform: translate3d(295px, 14px, -17px) rotateY(90deg); } .strap-section .strap:nth-child(10) .shake { -webkit-animation-delay: -27ms; animation-delay: -27ms; } .strap-section .strap:nth-child(11) { transform: translate3d(325px, 14px, -17px) rotateY(90deg); } .strap-section .strap:nth-child(11) .shake { -webkit-animation-delay: -97ms; animation-delay: -97ms; } .strap-section .strap:nth-child(12) { transform: translate3d(355px, 14px, -17px) rotateY(90deg); } .strap-section .strap:nth-child(12) .shake { -webkit-animation-delay: -64ms; animation-delay: -64ms; } .strap-section .strap:nth-child(13) { transform: translate3d(385px, 14px, -17px) rotateY(90deg); } .strap-section .strap:nth-child(13) .shake { -webkit-animation-delay: -98ms; animation-delay: -98ms; } .strap-section .strap:nth-child(14) { transform: translate3d(415px, 14px, -17px) rotateY(90deg); } .strap-section .strap:nth-child(14) .shake { -webkit-animation-delay: -94ms; animation-delay: -94ms; } .strap-section .strap:nth-child(15) { transform: translate3d(445px, 14px, -17px) rotateY(90deg); } .strap-section .strap:nth-child(15) .shake { -webkit-animation-delay: -2ms; animation-delay: -2ms; } .strap-section .strap:nth-child(16) { transform: translate3d(475px, 14px, -17px) rotateY(90deg); } .strap-section .strap:nth-child(16) .shake { -webkit-animation-delay: -24ms; animation-delay: -24ms; } .strap-section .strap:nth-child(17) { transform: translate3d(505px, 14px, -17px) rotateY(90deg); } .strap-section .strap:nth-child(17) .shake { -webkit-animation-delay: -56ms; animation-delay: -56ms; } .strap-section .strap:nth-child(18) { transform: translate3d(535px, 14px, -17px) rotateY(90deg); } .strap-section .strap:nth-child(18) .shake { -webkit-animation-delay: -15ms; animation-delay: -15ms; } .strap-section .strap:nth-child(19) { transform: translate3d(565px, 14px, -17px) rotateY(90deg); } .strap-section .strap:nth-child(19) .shake { -webkit-animation-delay: -62ms; animation-delay: -62ms; } .strap-section .strap:nth-child(20) { transform: translate3d(595px, 14px, -17px) rotateY(90deg); } .strap-section .strap:nth-child(20) .shake { -webkit-animation-delay: -81ms; animation-delay: -81ms; } .strap-section .strap:nth-child(21) { transform: translate3d(625px, 14px, -17px) rotateY(90deg); } .strap-section .strap:nth-child(21) .shake { -webkit-animation-delay: -21ms; animation-delay: -21ms; } .strap-section .strap:nth-child(22) { transform: translate3d(655px, 14px, -17px) rotateY(90deg); } .strap-section .strap:nth-child(22) .shake { -webkit-animation-delay: -15ms; animation-delay: -15ms; } .strap-section .strap:nth-child(23) { transform: translate3d(685px, 14px, -17px) rotateY(90deg); } .strap-section .strap:nth-child(23) .shake { -webkit-animation-delay: -20ms; animation-delay: -20ms; } .strap-section .strap:nth-child(24) { transform: translate3d(715px, 14px, -17px) rotateY(90deg); } .strap-section .strap:nth-child(24) .shake { -webkit-animation-delay: -99ms; animation-delay: -99ms; } .strap-section .strap:nth-child(25) { transform: translate3d(745px, 14px, -17px) rotateY(90deg); } .strap-section .strap:nth-child(25) .shake { -webkit-animation-delay: -37ms; animation-delay: -37ms; } .strap-section .strap:nth-child(26) { transform: translate3d(775px, 14px, -17px) rotateY(90deg); } .strap-section .strap:nth-child(26) .shake { -webkit-animation-delay: -40ms; animation-delay: -40ms; } .strap-section .strap:nth-child(27) { transform: translate3d(805px, 14px, -17px) rotateY(90deg); } .strap-section .strap:nth-child(27) .shake { -webkit-animation-delay: -21ms; animation-delay: -21ms; } .strap-section .strap:nth-child(28) { transform: translate3d(835px, 14px, -17px) rotateY(90deg); } .strap-section .strap:nth-child(28) .shake { -webkit-animation-delay: -13ms; animation-delay: -13ms; } .strap-section .strap:nth-child(29) { transform: translate3d(865px, 14px, -17px) rotateY(90deg); } .strap-section .strap:nth-child(29) .shake { -webkit-animation-delay: -52ms; animation-delay: -52ms; } .strap-section .strap:nth-child(30) { transform: translate3d(895px, 14px, -17px) rotateY(90deg); } .strap-section .strap:nth-child(30) .shake { -webkit-animation-delay: -60ms; animation-delay: -60ms; } .strap-section .strap:nth-child(n+7) .belt { height: 20px; } .strap-section .strap:nth-child(n+7) .handle { bottom: -22px; } .strap-section .shake { transform: rotateX(30deg); -webkit-animation: shake 1500ms ease-in-out infinite alternate; animation: shake 1500ms ease-in-out infinite alternate; transform-origin: 3px 1px; } @-webkit-keyframes shake { 0% { transform: rotateZ(-10deg); } 30% { transform: rotateZ(5deg); } 60% { transform: rotateZ(-5deg); } 100% { transform: rotateZ(10deg); } } @keyframes shake { 0% { transform: rotateZ(-10deg); } 30% { transform: rotateZ(5deg); } 60% { transform: rotateZ(-5deg); } 100% { transform: rotateZ(10deg); } } div { position: absolute; transform-style: preserve-3d; } body { display: grid; place-items: center; height: 100vh; overflow: hidden; } .container { position: relative; display: grid; grid-template-rows: repeat(21, 4.77vh); grid-template-columns: repeat(21, 4..........完整代码请登录后点击上方下载按钮下载查看
网友评论0