div+css实现三维数字翻页滚动计数器动画效果代码
代码语言:html
所属分类:动画
代码描述:div+css实现三维数字翻页滚动计数器动画效果代码,鼠标悬浮三维倾斜。
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <style> @import url("https://fonts.googleapis.com/css2?family=Anton&display=swap"); * { box-sizing: border-box; transform-style: preserve-3d; } body { margin: 0; width: 100vw; height: 100vh; overflow: hidden; font-family: "Anton", Arial, Helvetica, serif; background: linear-gradient(#030a03, #4e6c7a, #030a03); } .container { width: 100vw; height: 100vh; position: absolute; overflow: hidden; left: 0; top: 0; perspective: 100vmin; cursor: default; } .cam { float: left; width: 11.11%; height: 11.11%; z-index: 1; position: relative; cursor: zoom-in; } .cam:nth-child(1):hover ~ .container .number { transform: rotateX(12deg) rotateY(-40deg) translateZ(-10vmin); } .cam:nth-child(2):hover ~ .container .number { transform: rotateX(12deg) rotateY(-30deg) translateZ(-10vmin); } .cam:nth-child(3):hover ~ .container .number { transform: rotateX(12deg) rotateY(-20deg) translateZ(-10vmin); } .cam:nth-child(4):hover ~ .container .number { transform: rotateX(12deg) rotateY(-10deg) translateZ(-10vmin); } .cam:nth-child(5):hover ~ .container .number { transform: rotateX(12deg) rotateY(0deg) translateZ(-10vmin); } .cam:nth-child(6):hover ~ .container .number { transform: rotateX(12deg) rotateY(10deg) translateZ(-10vmin); } .cam:nth-child(7):hover ~ .container .number { transform: rotateX(12deg) rotateY(20deg) translateZ(-10vmin); } .cam:nth-child(8):hover ~ .container .number { transform: rotateX(12deg) rotateY(30deg) translateZ(-10vmin); } .cam:nth-child(9):hover ~ .container .number { transform: rotateX(12deg) rotateY(40deg) translateZ(-10vmin); } .cam:nth-child(10):hover ~ .container .number { transform: rotateX(9deg) rotateY(-40deg) translateZ(-10vmin); } .cam:nth-child(11):hover ~ .container .number { transform: rotateX(9deg) rotateY(-30deg) translateZ(-10vmin); } .cam:nth-child(12):hover ~ .container .number { transform: rotateX(9deg) rotateY(-20deg) translateZ(-10vmin); } .cam:nth-child(13):hover ~ .container .number { transform: rotateX(9deg) rotateY(-10deg) translateZ(-10vmin); } .cam:nth-child(14):hover ~ .container .number { transform: rotateX(9deg) rotateY(0deg) translateZ(-10vmin); } .cam:nth-child(15):hover ~ .container .number { transform: rotateX(9deg) rotateY(10deg) translateZ(-10vmin); } .cam:nth-child(16):hover ~ .container .number { transform: rotateX(9deg) rotateY(20deg) translateZ(-10vmin); } .cam:nth-child(17):hover ~ .container .number { transform: rotateX(9deg) rotateY(30deg) translateZ(-10vmin); } .cam:nth-child(18):hover ~ .container .number { transform: rotateX(9deg) rotateY(40deg) translateZ(-10vmin); } .cam:nth-child(19):hover ~ .container .number { transform: rotateX(6deg) rotateY(-40deg) translateZ(-10vmin); } .cam:nth-child(20):hover ~ .container .number { transform: rotateX(6deg) rotateY(-30deg) translateZ(-10vmin); } .cam:nth-child(21):hover ~ .container .number { transform: rotateX(6deg) rotateY(-20deg) translateZ(-10vmin); } .cam:nth-child(22):hover ~ .container .number { transform: rotateX(6deg) rotateY(-10deg) translateZ(-10vmin); } .cam:nth-child(23):hover ~ .container .number { transform: rotateX(6deg) rotateY(0deg) translateZ(-10vmin); } .cam:nth-child(24):hover ~ .container .number { transform: rotateX(6deg) rotateY(10deg) translateZ(-10vmin); } .cam:nth-child(25):hover ~ .container .number { transform: rotateX(6deg) rotateY(20deg) translateZ(-10vmin); } .cam:nth-child(26):hover ~ .container .number { transform: rotateX(6deg) rotateY(30deg) translateZ(-10vmin); } .cam:nth-child(27):hover ~ .container .number { transform: rotateX(6deg) rotateY(40deg) translateZ(-10vmin); } .cam:nth-child(28):hover ~ .container .number { transform: rotateX(3deg) rotateY(-40deg) translateZ(-10vmin); } .cam:nth-child(29):hover ~ .container .number { transform: rotateX(3deg) rotateY(-30deg) translateZ(-10vmin); } .cam:nth-child(30):hover ~ .container .number { transform: rotateX(3deg) rotateY(-20deg) translateZ(-10vmin); } .cam:nth-child(31):hover ~ .container .number { transform: rotateX(3deg) rotateY(-10deg) translateZ(-10vmin); } .cam:nth-child(32):hover ~ .container .number { transform: rotateX(3deg) rotateY(0deg) translateZ(-10vmin); } .cam:nth-child(33):hover ~ .container .number { transform: rotateX(3deg) rotateY(10deg) translateZ(-10vmin); } .cam:nth-child(34):hover ~ .container .number { transform: rotateX(3deg) rotateY(20deg) translateZ(-10vmin); } .cam:nth-child(35):hover ~ .container .number { transform: rotateX(3deg) rotateY(30deg) translateZ(-10vmin); } .cam:nth-child(36):hover ~ .container .number { transform: rotateX(3deg) rotateY(40deg) translateZ(-10vmin); } .cam:nth-child(37):hover ~ .container .number { transform: rotateX(0deg) rotateY(-40deg) translateZ(-10vmin); } .cam:nth-child(38):hover ~ .container .number { transform: rotateX(0deg) rotateY(-30deg) translateZ(-10vmin); } .cam:nth-child(39):hover ~ .container .number { transform: rotateX(0deg) rotateY(-20deg) translateZ(-10vmin); } .cam:nth-child(40):hover ~ .container .number { transform: rotateX(0deg) rotateY(-10deg) translateZ(-10vmin); } .cam:nth-child(41):hover ~ .container .number { transform: rotateX(0deg) rotateY(0deg) translateZ(-10vmin); } .cam:nth-child(42):hover ~ .container .number { transform: rotateX(0deg) rotateY(10deg) translateZ(-10vmin); } .cam:nth-child(43):hover ~ .container .number { transform: rotateX(0deg) rotateY(20deg) translateZ(-10vmin); } .cam:nth-child(44):hover ~ .container .number { transform: rotateX(0deg) rotateY(30deg) translateZ(-10vmin); } .cam:nth-child(45):hover ~ .container .number { transform: rotateX(0deg) rotateY(40deg) translateZ(-10vmin); } .cam:nth-child(46):hover ~ .container .number { transform: rotateX(-3deg) rotateY(-40deg) translateZ(-10vmin); } .cam:nth-child(47):hover ~ .container .number { transform: rotateX(-3deg) rotateY(-30deg) translateZ(-10vmin); } .cam:nth-child(48):hover ~ .container .number { transform: rotateX(-3deg) rotateY(-20deg) translateZ(-10vmin); } .cam:nth-child(49):hover ~ .container .number { transform: rotateX(-3deg) rotateY(-10deg) translateZ(-10vmin); } .cam:nth-child(50):hover ~ .container .number { transform: rotateX(-3deg) rotateY(0deg) translateZ(-10vmin); } .cam:nth-child(51):hover ~ .container .number { transform: rotateX(-3deg) rotateY(10deg) translateZ(-10vmin); } .cam:nth-child(52):hover ~ .container .number { transform: rotateX(-3deg) rotateY(20deg) translateZ(-10vmin); } .cam:nth-child(53):hover ~ .container .number { transform: rotateX(-3deg) rotateY(30deg) translateZ(-10vmin); } .cam:nth-child(54):hover ~ .container .number { transform: rotateX(-3deg) rotateY(40deg) translateZ(-10vmin); } .cam:nth-child(55):hover ~ .container .number { transform: rotateX(-6deg) rotateY(-40deg) translateZ(-10vmin); } .cam:nth-child(56):hover ~ .container .number { transform: rotateX(-6deg) rotateY(-30deg) translateZ(-10vmin); } .cam:nth-child(57):hover ~ .container .number { transform: rotateX(-6deg) rotateY(-20deg) translateZ(-10vmin); } .cam:nth-child(58):hover ~ .container .number { transform: rotateX(-6deg) rotateY(-10deg) translateZ(-10vmin); } .cam:nth-child(59):hover ~ .container .number { transform: rotateX(-6deg) rotateY(0deg) translateZ(-10vmin); } .cam:nth-child(60):hover ~ .container .number { transform: rotateX(-6deg) rotateY(10deg) translateZ(-10vmin); } .cam:nth-child(61):hover ~ .container .number { transform: rotateX(-6deg) rotateY(20deg) translateZ(-10vmin); } .cam:nth-child(62):hover ~ .container .number { transform: rotateX(-6deg) rotateY(30deg) translateZ(-10vmin); } .cam:nth-child(63):hover ~ .container .number { transform: rotateX(-6deg) rotateY(40deg) translateZ(-10vmin); } .cam:nth-child(64):hover ~ .container .number { transform: rotateX(-9deg) rotateY(-40deg) translateZ(-10vmin); } .cam:nth-child(65):hover ~ .container .number { transform: rotateX(-9deg) rotateY(-30deg) translateZ(-10vmin); } .cam:nth-child(66):hover ~ .container .number { transform: rotateX(-9deg) rotateY(-20deg) translateZ(-10vmin); } .cam:nth-child(67):hover ~ .container .number { transform: rotateX(-9deg) rotateY(-10deg) translateZ(-10vmin); } .cam:nth-child(68):hover ~ .container .number { transform: rotateX(-9deg) rotateY(0deg) translateZ(-10vmin); } .cam:nth-child(69):hover ~ .container .number { transform: rotateX(-9deg) rotateY(10deg) translateZ(-10vmin); } .cam:nth-child(70):hover ~ .container .number { transform: rotateX(-9deg) rotateY(20deg) translateZ(-10vmin); } .cam:nth-child(71):hover ~ .container .number { transform: rotateX(-9deg) rotateY(30deg) translateZ(-10vmin); } .cam:nth-child(72):hover ~ .container .number { transform: rotateX(-9deg) rotateY(40deg) translateZ(-10vmin); } .cam:nth-child(73):hover ~ .container .number { transform: rotateX(-12deg) rotateY(-40deg) translateZ(-10vmin); } .cam:nth-child(74):hover ~ .container .number { transform: rotateX(-12deg) rotateY(-30deg) translateZ(-10vmin); } .cam:nth-child(75):hover ~ .container .number { transform: rotateX(-12deg) rotateY(-20deg) translateZ(-10vmin); } .cam:nth-child(76):hover ~ .container .number { transform: rotateX(-12deg) rotateY(-10deg) translateZ(-10vmin); } .cam:nth-child(77):hover ~ .container .number { transform: rotateX(-12deg) rotateY(0deg) translateZ(-10vmin); } .cam:nth-child(78):hover ~ .container .number { transform: rotateX(-12deg) rotateY(10deg) translateZ(-10vmin); } .cam:nth-child(79):hover ~ .container .number { transform: rotateX(-12deg) rotateY(20deg) translateZ(-10vmin); } .cam:nth-child(80):hover ~ .container .number { transform: rotateX(-12deg) rotateY(30deg) translateZ(-10vmin); } .cam:nth-child(81):hover ~ .container .number { transform: rotateX(-12deg) rotateY(40deg) translateZ(-10vmin); } .cam:active ~ .container { transform: scale3d(1.25, 1.25, 1.25); transition: all 0.75s ease 0s; } .cam:active ~ .container .number .wheel.d-0 { animation: spin-wheel 4s linear 0s infinite; } .cam:active ~ .container .number .wheel.d-1 { animation: spin-wheel 2s linear 0s infinite; } .cam:active ~ .container .number .wheel.d-2, .cam:active ~ .container .number .wheel.d-4 { animation: spin-wheel 1s linear 0s infinite; } .cam:active ~ .container .number .wheel.d-3 { animation: spin-wheel 0.5s linear 0s infinite; } .cam:hover ~ .container { transition: all 0.5s ease 0s; } .number { height: 100vh; display: flex; justify-content: center; align-items: center; transform: translateZ(-10vmin); animation: start 4s ease 0s 1; transition: all 0.25s ease 0s; } @keyframes start { 0% { transform: rotateY(0deg) rotateX(0deg) translateZ(-10vmin); } 25% { transform: rotateY(28deg) rotateX(-11deg) translateZ(-10vmin); } 50% { transform: rotateY(0deg) rotateX(11deg) translateZ(-10vmin); } 75% { transform: rotateY(-28deg) rotateX(-11deg) translateZ(-10vmin); } 100% { transform: rotateY(0deg) rotateX(0deg) translateZ(-10vmin); } } .thanks, .followers { height: 20vh; line-height: 20vh; font-size: 16vmin; position: absolute; transform: translate3d(0, -34vmin, 22vmin); animation: txt-thanks 2s ease 0s 1; text-align: center; width: 70vmin; } .followers { transform: translate3d(0, 34vmin, -22vmin); animation: txt-followers 2s ease 1s 1; animation-fill-mode: forwards; } .followers.text3d span:nth-child(1) { animation-delay: 2s; } @keyframes txt-thanks { 0% { transform: translate3d(0, -34vmin, -22vmin); } 100% { transform: translate3d(0, -34vmin, 22vmin); } } @keyframes txt-followers { 0% { transform: translate3d(0, 34vmin, -22vmin); } 100% { transform: translate3d(0, 34vmin, 22vmin); } } .text3d span { position: absolute; display: block; width: 100%; color: #d9dfe1c4; transform: scaleY(0.75); text-transform: uppercase; } .text3d span:nth-child(1) { animation: text-color 0.1s ease 1s 1; animation-fill-mode: forwards; } .text3d span:nth-child(1n+2) { transform: translateZ(-0.25vmin) scaleY(0.75); -webkit-text-stroke: 0.3vmin #232323; color: #fff0; -webkit-text-fill-color: #ffffff47; } .text3d span:nth-child(3) { transform: translateZ(-0.5vmin) scaleY(0.75); } .text3d span:nth-child(4) { transform: translateZ(-0.75vmin) scaleY(0.75); } .text3d span:nth-child(5) { transform: translateZ(-1vmin) scaleY(0.75); } .text3d span:nth-child(6) { transform: translateZ(-1.25vmin) scaleY(0.75); } .text3d span:nth-child(7) { transform: translateZ(-1.5vmin) scaleY(0.75); } .text3d span:nth-child(8) { transform: translateZ(-1.75vmin) scaleY(0.75); } .text3d span:nth-child(9) { transform: translateZ(-2vmin) scaleY(0.75); } .text3d span:nth-child(10) { transform: translateZ(-2.25vmin) scaleY(0.75); -webkit-text-stroke-color: #111; } @keyframes text-color { 100% { text-shadow: 0 0 0.5vmin #00e2ff, 0 0 2vmin #00feff; color: #dfe4e6; } } /*** WHEEL ***/ .wheel { --width: 50; --height: 50; --depth: 12; --hue: 200; --sat: 0%; height: calc(var(--height) * 1vmin); width: calc(var(--width) * 1vmin); position: absolute; transform: rotateX(-90deg) rotateZ(0deg) rotateY(90deg); /*.face*/ } .wheel .face { position: absolute; top: 50%; left: 50%; height: 100%; width: 100%; background: linear-gradient(-90deg, #00e3ff47, #0000), repeating-radial-gradient(circle at 50% 50%, #000, #222); box-shadow: 0 0 2vmin 2vmin #101010 inset; overflow: hidden; border-radius: 0.125vmin; background-size: 1% 1%; border: 0.15vmin solid #333; --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% ); } .wheel .face:nth-of-type(1) { clip-path: var(--deca); transform: translate3d(-50%, -50%, calc(var(--depth) * 0.5vmin)); background: linear-gradient(-90deg, #fff9, #0000), repeating-radial-gradient(circle at 50% 50%, #000, #222); box-shadow: none; border: 0; background-size: 0.5% 0.5%; } .wheel .face:nth-of-type(2) { clip-path: var(--deca); transform: translate3d(-50%, -50%, calc(var(--depth) * -0.5vmin)) rotateY(180deg); background: linear-gradient(-90deg, #fff9, #0000), repeating-radial-gradient(circle at 50% 50%, #000, #222); box-shadow: none; border: 0; background-size: 0.5% 0.5%; } .wheel .face:nth-of-type(1n+3) { width: calc(calc(calc(var(--width) * 31) / 100) * 1vmin); height: calc(var(--depth) * 1vmin); transform: translate(-50%, -50%) rotateY(90deg) rotateX(90deg) rotateZ(-90deg) translate3d(0vmin, 0, calc(var(--width) * 0.475vmin)); filter: hue-rotate(360deg); display: flex; align-items: center; justify-content: center; } .wheel .face:nth-of-type(1n+3):after { content: "0"; transform: rotate(-90deg); position: absolute; font-size: 12vmin; color: #fff; text-shadow: 2px 2px 0px #000, 0px 0px 5px #00bcd4; /*animation: text-color 0s ease 3.95s 1; animation-fill-mode: forwards;*/ } .wheel .face:nth-of-type(4) { transform: translate(-50%, -50%) rotateY(90deg) rotateX(54deg) rotateZ(-90deg) translate3d(0vmin, 0, calc(var(--width) * 0.475vmin)); } .wheel .face:nth-of-type(5) { transform: translate(-50%, -50%) rotateY(90deg) rotateX(18deg) rotateZ(-90deg) translate3d(0vmin, 0, calc(var(--width) * 0.475vmin)); } .wheel .face:nth-of-type(6) { transform: translate(-50%, -50%) rotateY(90deg) rotateX(-18deg) rotateZ(-90deg) translate3d(0vmin, 0, calc(var(--width) * 0.475vmin)); } .wheel .face:nth-of-type(7) { transform: translate(-50%, -50%) rotateY(90deg) rotateX(-54deg) rotateZ(-90deg) translate3d(0vmin, 0, calc(var(--width) * 0.475vmin)); } .wheel .face:nth-of-type(8) { transform: translate(-50%, -50%) rotateY(90deg) rotateX(-90deg) ro.........完整代码请登录后点击上方下载按钮下载查看
网友评论0