css实现一个老式带声音三维收音机闹钟起床器效果代码
代码语言:html
所属分类:三维
代码描述:css实现一个老式带声音三维收音机闹钟起床器效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> @charset "UTF-8"; /*** DEBUGGING SOME ERROR IN FIREFOX ***/ @import url("https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Michroma&display=swap"); :root { --bf: #111; --grad: linear-gradient(0deg, #ffffffab, #ffffffdb); --deca: polygon( 34.54915% 2.44717%, 65.45085% 2.44717%, 90.45085% 20.61074%, 100% 50%, 90.45085% 79.38926%, 65.45085% 97.55283%, 34.54915% 97.55283%, 9.54915% 79.38926%, 0% 50%, 9.54915% 20.61074% ); } * { transform-style: preserve-3d; box-sizing: border-box; } body { margin: 0; height: 100vh; overflow: hidden; background: radial-gradient(circle at 50% 50%, #333, #000); font-family: Arial, Helvetica, serif; } .cam { transform: translateZ(30vmin); float: left; width: 11.11%; height: 11.11%; z-index: 1; position: relative; cursor: pointer; } .cam:nth-child(1):hover ~ .content .clock { transform: rotateX(40deg) rotateY(-40deg); } .cam:nth-child(2):hover ~ .content .clock { transform: rotateX(40deg) rotateY(-30deg); } .cam:nth-child(3):hover ~ .content .clock { transform: rotateX(40deg) rotateY(-20deg); } .cam:nth-child(4):hover ~ .content .clock { transform: rotateX(40deg) rotateY(-10deg); } .cam:nth-child(5):hover ~ .content .clock { transform: rotateX(40deg) rotateY(0deg); } .cam:nth-child(6):hover ~ .content .clock { transform: rotateX(40deg) rotateY(10deg); } .cam:nth-child(7):hover ~ .content .clock { transform: rotateX(40deg) rotateY(20deg); } .cam:nth-child(8):hover ~ .content .clock { transform: rotateX(40deg) rotateY(30deg); } .cam:nth-child(9):hover ~ .content .clock { transform: rotateX(40deg) rotateY(40deg); } .cam:nth-child(10):hover ~ .content .clock { transform: rotateX(30deg) rotateY(-40deg); } .cam:nth-child(11):hover ~ .content .clock { transform: rotateX(30deg) rotateY(-30deg); } .cam:nth-child(12):hover ~ .content .clock { transform: rotateX(30deg) rotateY(-20deg); } .cam:nth-child(13):hover ~ .content .clock { transform: rotateX(30deg) rotateY(-10deg); } .cam:nth-child(14):hover ~ .content .clock { transform: rotateX(30deg) rotateY(0deg); } .cam:nth-child(15):hover ~ .content .clock { transform: rotateX(30deg) rotateY(10deg); } .cam:nth-child(16):hover ~ .content .clock { transform: rotateX(30deg) rotateY(20deg); } .cam:nth-child(17):hover ~ .content .clock { transform: rotateX(30deg) rotateY(30deg); } .cam:nth-child(18):hover ~ .content .clock { transform: rotateX(30deg) rotateY(40deg); } .cam:nth-child(19):hover ~ .content .clock { transform: rotateX(20deg) rotateY(-40deg); } .cam:nth-child(20):hover ~ .content .clock { transform: rotateX(20deg) rotateY(-30deg); } .cam:nth-child(21):hover ~ .content .clock { transform: rotateX(20deg) rotateY(-20deg); } .cam:nth-child(22):hover ~ .content .clock { transform: rotateX(20deg) rotateY(-10deg); } .cam:nth-child(23):hover ~ .content .clock { transform: rotateX(20deg) rotateY(0deg); } .cam:nth-child(24):hover ~ .content .clock { transform: rotateX(20deg) rotateY(10deg); } .cam:nth-child(25):hover ~ .content .clock { transform: rotateX(20deg) rotateY(20deg); } .cam:nth-child(26):hover ~ .content .clock { transform: rotateX(20deg) rotateY(30deg); } .cam:nth-child(27):hover ~ .content .clock { transform: rotateX(20deg) rotateY(40deg); } .cam:nth-child(28):hover ~ .content .clock { transform: rotateX(10deg) rotateY(-40deg); } .cam:nth-child(29):hover ~ .content .clock { transform: rotateX(10deg) rotateY(-30deg); } .cam:nth-child(30):hover ~ .content .clock { transform: rotateX(10deg) rotateY(-20deg); } .cam:nth-child(31):hover ~ .content .clock { transform: rotateX(10deg) rotateY(-10deg); } .cam:nth-child(32):hover ~ .content .clock { transform: rotateX(10deg) rotateY(0deg); } .cam:nth-child(33):hover ~ .content .clock { transform: rotateX(10deg) rotateY(10deg); } .cam:nth-child(34):hover ~ .content .clock { transform: rotateX(10deg) rotateY(20deg); } .cam:nth-child(35):hover ~ .content .clock { transform: rotateX(10deg) rotateY(30deg); } .cam:nth-child(36):hover ~ .content .clock { transform: rotateX(10deg) rotateY(40deg); } .cam:nth-child(37):hover ~ .content .clock { transform: rotateX(0deg) rotateY(-40deg); } .cam:nth-child(38):hover ~ .content .clock { transform: rotateX(0deg) rotateY(-30deg); } .cam:nth-child(39):hover ~ .content .clock { transform: rotateX(0deg) rotateY(-20deg); } .cam:nth-child(40):hover ~ .content .clock { transform: rotateX(0deg) rotateY(-10deg); } .cam:nth-child(41):hover ~ .content .clock { transform: rotateX(0deg) rotateY(0deg); } .cam:nth-child(42):hover ~ .content .clock { transform: rotateX(0deg) rotateY(10deg); } .cam:nth-child(43):hover ~ .content .clock { transform: rotateX(0deg) rotateY(20deg); } .cam:nth-child(44):hover ~ .content .clock { transform: rotateX(0deg) rotateY(30deg); } .cam:nth-child(45):hover ~ .content .clock { transform: rotateX(0deg) rotateY(40deg); } .cam:nth-child(46):hover ~ .content .clock { transform: rotateX(-10deg) rotateY(-40deg); } .cam:nth-child(47):hover ~ .content .clock { transform: rotateX(-10deg) rotateY(-30deg); } .cam:nth-child(48):hover ~ .content .clock { transform: rotateX(-10deg) rotateY(-20deg); } .cam:nth-child(49):hover ~ .content .clock { transform: rotateX(-10deg) rotateY(-10deg); } .cam:nth-child(50):hover ~ .content .clock { transform: rotateX(-10deg) rotateY(0deg); } .cam:nth-child(51):hover ~ .content .clock { transform: rotateX(-10deg) rotateY(10deg); } .cam:nth-child(52):hover ~ .content .clock { transform: rotateX(-10deg) rotateY(20deg); } .cam:nth-child(53):hover ~ .content .clock { transform: rotateX(-10deg) rotateY(30deg); } .cam:nth-child(54):hover ~ .content .clock { transform: rotateX(-10deg) rotateY(40deg); } .cam:nth-child(55):hover ~ .content .clock { transform: rotateX(-20deg) rotateY(-40deg); } .cam:nth-child(56):hover ~ .content .clock { transform: rotateX(-20deg) rotateY(-30deg); } .cam:nth-child(57):hover ~ .content .clock { transform: rotateX(-20deg) rotateY(-20deg); } .cam:nth-child(58):hover ~ .content .clock { transform: rotateX(-20deg) rotateY(-10deg); } .cam:nth-child(59):hover ~ .content .clock { transform: rotateX(-20deg) rotateY(0deg); } .cam:nth-child(60):hover ~ .content .clock { transform: rotateX(-20deg) rotateY(10deg); } .cam:nth-child(61):hover ~ .content .clock { transform: rotateX(-20deg) rotateY(20deg); } .cam:nth-child(62):hover ~ .content .clock { transform: rotateX(-20deg) rotateY(30deg); } .cam:nth-child(63):hover ~ .content .clock { transform: rotateX(-20deg) rotateY(40deg); } .cam:nth-child(64):hover ~ .content .clock { transform: rotateX(-30deg) rotateY(-40deg); } .cam:nth-child(65):hover ~ .content .clock { transform: rotateX(-30deg) rotateY(-30deg); } .cam:nth-child(66):hover ~ .content .clock { transform: rotateX(-30deg) rotateY(-20deg); } .cam:nth-child(67):hover ~ .content .clock { transform: rotateX(-30deg) rotateY(-10deg); } .cam:nth-child(68):hover ~ .content .clock { transform: rotateX(-30deg) rotateY(0deg); } .cam:nth-child(69):hover ~ .content .clock { transform: rotateX(-30deg) rotateY(10deg); } .cam:nth-child(70):hover ~ .content .clock { transform: rotateX(-30deg) rotateY(20deg); } .cam:nth-child(71):hover ~ .content .clock { transform: rotateX(-30deg) rotateY(30deg); } .cam:nth-child(72):hover ~ .content .clock { transform: rotateX(-30deg) rotateY(40deg); } .cam:nth-child(73):hover ~ .content .clock { transform: rotateX(-40deg) rotateY(-40deg); } .cam:nth-child(74):hover ~ .content .clock { transform: rotateX(-40deg) rotateY(-30deg); } .cam:nth-child(75):hover ~ .content .clock { transform: rotateX(-40deg) rotateY(-20deg); } .cam:nth-child(76):hover ~ .content .clock { transform: rotateX(-40deg) rotateY(-10deg); } .cam:nth-child(77):hover ~ .content .clock { transform: rotateX(-40deg) rotateY(0deg); } .cam:nth-child(78):hover ~ .content .clock { transform: rotateX(-40deg) rotateY(10deg); } .cam:nth-child(79):hover ~ .content .clock { transform: rotateX(-40deg) rotateY(20deg); } .cam:nth-child(80):hover ~ .content .clock { transform: rotateX(-40deg) rotateY(30deg); } .cam:nth-child(81):hover ~ .content .clock { transform: rotateX(-40deg) rotateY(40deg); } .cam:active ~ .content { transform: scale3d(1.5, 1.5, 1.5); transition: all 1s ease 0.5s; } .cam:hover ~ .content { transition: all 1s ease 0.5s; } body.zoom .cam { cursor: zoom-in; } .content { width: 100vw; height: 100vh; margin: 0 auto; justify-content: center; align-items: center; display: flex; flex-wrap: wrap; align-content: center; perspective: 150vmin; perspective-origin: center; position: absolute; z-index: -1; transition: all 1s ease 0.5s; } /*** CUBOID ***/ .cuboid { --hue: 0; --sat: 0%; height: calc(var(--height) * 1vmin); width: calc(var(--width) * 1vmin); position: absolute; } .side { position: absolute; top: 50%; left: 50%; height: 100%; width: 100%; box-sizing: border-box; border-radius: 0.35vmin; } .side:nth-of-type(1) { transform: translate3d(-50%, -50%, calc(var(--depth) * 0.5vmin)); background: var(--grad), hsl(var(--hue), var(--sat), 50%); } .side:nth-of-type(2) { transform: translate3d(-50%, -50%, calc(var(--depth) * -0.5vmin)) rotateY(180deg); background: var(--grad), hsl(var(--hue), var(--sat), 35%); } .side:nth-of-type(3) { width: calc(var(--depth) * 1vmin); transform: translate(-50%, -50%) rotateY(90deg) translate3d(0, 0, calc(var(--width) * 0.5vmin)); background: var(--grad), hsl(var(--hue), var(--sat), 40%); } .side:nth-of-type(4) { width: calc(var(--depth) * 1vmin); transform: translate(-50%, -50%) rotateY(-90deg) translate3d(0, 0, calc(var(--width) * 0.5vmin)); background: var(--grad), hsl(var(--hue), var(--sat), 60%); } .side:nth-of-type(5) { height: calc(var(--depth) * 1vmin); transform: translate(-50%, -50%) rotateX(90deg) translate3d(0, 0, calc(var(--height) * 0.5vmin)); background: var(--grad), hsl(var(--hue), var(--sat), 70%); border: 1px solid hsl(var(--hue), 0%, 50%); } .side:nth-of-type(6) { height: calc(var(--depth) * 1vmin); transform: translate(-50%, -50%) rotateX(-90deg) translate3d(0, 0, calc(var(--height) * 0.5vmin)); background: var(--grad), hsl(var(--hue), var(--sat), 25%); } /*** CLOCK ***/ .clock { --width: 80; --height: 20; --depth: 60; transform: rotateX(-10deg) rotateY(20deg); transition: all 0.5s ease 0s; animation: init 3.8s ease 0s; } .clock > .side:nth-child(1) { background: linear-gradient(-40deg, #fff0 0 44%, #122f4630 45.35% 52%, #fff0 55.35% 57%, #122f4661 60.25% 65%, #fff0 75.25% 100%), #051c2e3b; } .clock > .side:nth-of-type(5) { font-size: 1.35vmin; text-shadow: 0 -1px 0 #ccc; color: #fff; } .clock > .side:nth-of-type(5):before { content: ""; position: absolute; background: repeating-radial-gradient(#f7f7f7bd 0 30%, #fff0 35% 100%); width: 55%; height: 58%; left: 24%; top: 10%; background-repeat: repeat; background-size: 1.25vmin 1.25vmin; filter: drop-shadow(-1px 1px 1px #000); } .clock > .side:nth-of-type(5):after { position: absolute; width: 11%; height: 7%; left: 82%; top: 82%; border: 0.1vmin solid #fff0; border-color: #00000014 #fff9 #fff9 #00000014; border-radius: 0.5vmin; font-size: 1vmin; content: "FM AM"; word-spacing: 4vmin; text-align: center; padding: 1.35vmin 0.5vmin; box-sizing: border-box; background: radial-gradient(circle at 45% 50%, #3a3a3a 0 1.25vmin, transparent 1.35vmin 100%), radial-gradient(circle at 50% 50%, #3a3a3a 0 1.25vmin, transparent 1.35vmin 100%), radial-gradient(circle at 55% 50%, #3a3a3a 0 1.25vmin, transparent 1.35vmin 100%); } @keyframes init { 50% { transform: rotateX(10deg) rotateY(-20deg); } } .sleep { position: absolute; bottom: 11vmin; left: 2vmin; } .sleep:before { content: " 0FF \aON"; white-space: pre-wrap; position: absolute; top: -3.75vmin; line-height: 1vmin; font-size: 1.25vmin; left: 7vmin; } .sleep:after { content: " ALARM \a AUTO"; white-space: pre-wrap; position: absolute; top: -8.75vmin; line-height: 2vmin; font-size: 1.125vmin; left: 11.5vmin; } /*** BASE ***/ .base { --width: 60; --height: 8; --depth: 40; transform: translate3d(10vmin, 20vmin, 0vmin); } .base > .side { border: 0.125vmin solid #0003; } /*** BLACK ***/ .black { --width: 79; --height: 19; --depth: 55; transform: translate3d(0.5vmin, 0.5vmin, -2vmin); } .black > .side { border: 0.125vmin solid #0004; background: #333; } .black > .side:nth-of-type(1) { background: linear-gradient(90deg, var(--bf) 0 6%, #fff0 0 13%, var(--bf) 0 19%, #fff0 0 49%, var(--bf) 0 54%, #fff0 0 95%, var(--bf) 0 100%), linear-gradient(0deg, var(--bf) 0 18%, #fff0 0 82%, var(--bf) 0 100%); } /*** DIAL ***/ .dial { --width: 32; --height: 12; --depth: 55; transform: translate3d(43.5vmin, 4.075vmin, -2vmin); } .dial > .side { border: 0.125vmin solid #0004; background: #111; } .dial > .side:nth-of-type(1) { transform: translate3d(-50%, -50%, calc(var(--depth) * 0.485vmin)); background: #000; } .dial > .side:nth-of-type(1):before { content: "Panasonic"; color: #fff; font-weight: bold; font-size: 1.85vmin; float: left; width: 100%; text-align: right; padding: 1vmin 1.5vmin 1vmin 1vmin; box-sizing: border-box; } .dial > .side:nth-of-type(1):after { content: ""; font-weight: bold; float: left; width: calc(100% - 2vmin); border-bottom: 0.5vmin dotted #fff; margin: 2vmin 1vmin 1vmin; } .dial > .side:nth-of-type(1) > div { color: #fff; font-size: 1.5vmin; } .am { word-spacing: 0.4vmin; margin-top: 1.25vmin; } .am:before { content: "AM"; float: left; margin-right.........完整代码请登录后点击上方下载按钮下载查看
网友评论0