css数字组建动画效果
代码语言:html
所属分类:动画
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>- Procedurally Generated CSS Numbers</title> <style> body { background: #222; --color1: #ccd8eb; --color2: #3079e2; --bg: transparent; height: 100vh; width: 100vw; display: flex; justify-content: center; align-items: center; min-width: 900px; font-family: 'Roboto Mono', monospace; } body .reset { position: absolute; bottom: 20px; left: 50%; -webkit-transform: translateX(-50%) scaleX(0); transform: translateX(-50%) scaleX(0); color: #fff; font-weight: 100; font-size: 12px; letter-spacing: 2px; cursor: pointer; background: transparent; border: none; font-family: 'Roboto Mono', monospace; outline: none; transition: 300ms cubic-bezier(0.175, 0.885, 0.32, 1.275); } body .reset:hover:after { -webkit-transform: scaleX(1); transform: scaleX(1); } body .reset:after { content: ''; position: absolute; width: 100%; height: 1px; background: var(--color1); bottom: -5px; left: 0; transition: 0.3s cubic-bezier(1, 0, 0, 1); -webkit-transform: scaleX(0); transform: scaleX(0); -webkit-transform-origin: left; transform-origin: left; } body.two .last { display: none; } body.two #wrap { width: 600px; } body.active .reset { -webkit-transform: translateX(-50%) scaleX(1); transform: translateX(-50%) scaleX(1); transition-delay: 3s; } body.active #wrap { opacity: 1; } body.active #formwrap { opacity: 0; } body #formwrap { position: absolute; width: 100vw; z-index: 999; text-align: center; transition: 0.3s ease-in-out; left: 0; } body #formwrap form { display: inline-block; } body #formwrap form input[type=number]::-webkit-inner-spin-button, body #formwrap form input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; } body #formwrap form input[type="number"] { font-family: 'Roboto Mono', monospace; background: transparent; border: none; border-bottom: 1px solid var(--color2); height: auto; text-align: center; outline: none; width: 25vmin; color: var(--color2); font-size: 10vmin; line-height: 1; padding: 1rem 0; } body #formwrap form input[type="number"]:hover, body #formwrap form input[type="number"]:focus { outline: none; } body #formwrap form input[type="number"]:focus::-webkit-input-placeholder { opacity: 0; } body #formwrap form input[type="number"]:focus:-ms-input-placeholder { opacity: 0; } body #formwrap form input[type="number"]:focus::-ms-input-placeholder { opacity: 0; } body #formwrap form input[type="number"]:focus::placeholder { opacity: 0; } body #formwrap form input[type="number"]::-webkit-input-placeholder { color: #666; font-size: 5vmin; opacity: 1; } body #formwrap form input[type="number"]:-ms-input-placeholder { color: #666; font-size: 5vmin; opacity: 1; } body #formwrap form input[type="number"]::-ms-input-placeholder { color: #666; font-size: 5vmin; opacity: 1; } body #formwrap form input[type="number"]::placeholder { color: #666; font-size: 5vmin; opacity: 1; } body #formwrap form input[type="submit"] { opacity: 1; color: var(--color2); background: transparent; border: 1px solid; font-size: 5vmin; width: 25vmin; text-align: center; margin-top: 5vmin; transition: 0.3s ease-in-out; cursor: pointer; } body #formwrap form input[type="submit"]:hover { color: var(--color1); } body #wrap { width: 900px; height: 600px; display: flex; flex-wrap: wrap; background: #222; opacity: 0; } body #wrap.loading { -webkit-animation: fadeIn 0.5s ease-in-out 1 forwards; animation: fadeIn 0.5s ease-in-out 1 forwards; opacity: 0; -webkit-animation-delay: 0.5s; animation-delay: 0.5s; } @-webkit-keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } } @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } } body #wrap:not(.loading) .number .cell:nth-of-type(1) { -webkit-animation-delay: 0.02s !important; animation-delay: 0.02s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(2) { -webkit-animation-delay: 0.04s !important; animation-delay: 0.04s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(3) { -webkit-animation-delay: 0.06s !important; animation-delay: 0.06s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(4) { -webkit-animation-delay: 0.08s !important; animation-delay: 0.08s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(5) { -webkit-animation-delay: 0.1s !important; animation-delay: 0.1s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(6) { -webkit-animation-delay: 0.12s !important; animation-delay: 0.12s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(7) { -webkit-animation-delay: 0.14s !important; animation-delay: 0.14s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(8) { -webkit-animation-delay: 0.16s !important; animation-delay: 0.16s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(9) { -webkit-animation-delay: 0.18s !important; animation-delay: 0.18s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(10) { -webkit-animation-delay: 0.2s !important; animation-delay: 0.2s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(11) { -webkit-animation-delay: 0.22s !important; animation-delay: 0.22s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(12) { -webkit-animation-delay: 0.24s !important; animation-delay: 0.24s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(13) { -webkit-animation-delay: 0.26s !important; animation-delay: 0.26s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(14) { -webkit-animation-delay: 0.28s !important; animation-delay: 0.28s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(15) { -webkit-animation-delay: 0.3s !important; animation-delay: 0.3s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(16) { -webkit-animation-delay: 0.32s !important; animation-delay: 0.32s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(17) { -webkit-animation-delay: 0.34s !important; animation-delay: 0.34s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(18) { -webkit-animation-delay: 0.36s !important; animation-delay: 0.36s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(19) { -webkit-animation-delay: 0.38s !important; animation-delay: 0.38s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(20) { -webkit-animation-delay: 0.4s !important; animation-delay: 0.4s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(21) { -webkit-animation-delay: 0.42s !important; animation-delay: 0.42s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(22) { -webkit-animation-delay: 0.44s !important; animation-delay: 0.44s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(23) { -webkit-animation-delay: 0.46s !important; animation-delay: 0.46s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(24) { -webkit-animation-delay: 0.48s !important; animation-delay: 0.48s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(25) { -webkit-animation-delay: 0.5s !important; animation-delay: 0.5s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(26) { -webkit-animation-delay: 0.52s !important; animation-delay: 0.52s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(27) { -webkit-animation-delay: 0.54s !important; animation-delay: 0.54s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(28) { -webkit-animation-delay: 0.56s !important; animation-delay: 0.56s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(29) { -webkit-animation-delay: 0.58s !important; animation-delay: 0.58s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(30) { -webkit-animation-delay: 0.6s !important; animation-delay: 0.6s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(31) { -webkit-animation-delay: 0.62s !important; animation-delay: 0.62s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(32) { -webkit-animation-delay: 0.64s !important; animation-delay: 0.64s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(33) { -webkit-animation-delay: 0.66s !important; animation-delay: 0.66s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(34) { -webkit-animation-delay: 0.68s !important; animation-delay: 0.68s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(35) { -webkit-animation-delay: 0.7s !important; animation-delay: 0.7s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(36) { -webkit-animation-delay: 0.72s !important; animation-delay: 0.72s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(37) { -webkit-animation-delay: 0.74s !important; animation-delay: 0.74s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(38) { -webkit-animation-delay: 0.76s !important; animation-delay: 0.76s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(39) { -webkit-animation-delay: 0.78s !important; animation-delay: 0.78s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(40) { -webkit-animation-delay: 0.8s !important; animation-delay: 0.8s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(41) { -webkit-animation-delay: 0.82s !important; animation-delay: 0.82s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(42) { -webkit-animation-delay: 0.84s !important; animation-delay: 0.84s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(43) { -webkit-animation-delay: 0.86s !important; animation-delay: 0.86s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(44) { -webkit-animation-delay: 0.88s !important; animation-delay: 0.88s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(45) { -webkit-animation-delay: 0.9s !important; animation-delay: 0.9s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(46) { -webkit-animation-delay: 0.92s !important; animation-delay: 0.92s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(47) { -webkit-animation-delay: 0.94s !important; animation-delay: 0.94s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(48) { -webkit-animation-delay: 0.96s !important; animation-delay: 0.96s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(49) { -webkit-animation-delay: 0.98s !important; animation-delay: 0.98s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(50) { -webkit-animation-delay: 1s !important; animation-delay: 1s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(51) { -webkit-animation-delay: 1.02s !important; animation-delay: 1.02s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(52) { -webkit-animation-delay: 1.04s !important; animation-delay: 1.04s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(53) { -webkit-animation-delay: 1.06s !important; animation-delay: 1.06s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(54) { -webkit-animation-delay: 1.08s !important; animation-delay: 1.08s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(55) { -webkit-animation-delay: 1.1s !important; animation-delay: 1.1s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(56) { -webkit-animation-delay: 1.12s !important; animation-delay: 1.12s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(57) { -webkit-animation-delay: 1.14s !important; animation-delay: 1.14s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(58) { -webkit-animation-delay: 1.16s !important; animation-delay: 1.16s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(59) { -webkit-animation-delay: 1.18s !important; animation-delay: 1.18s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(60) { -webkit-animation-delay: 1.2s !important; animation-delay: 1.2s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(61) { -webkit-animation-delay: 1.22s !important; animation-delay: 1.22s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(62) { -webkit-animation-delay: 1.24s !important; animation-delay: 1.24s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(63) { -webkit-animation-delay: 1.26s !important; animation-delay: 1.26s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(64) { -webkit-animation-delay: 1.28s !important; animation-delay: 1.28s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(65) { -webkit-animation-delay: 1.3s !important; animation-delay: 1.3s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(66) { -webkit-animation-delay: 1.32s !important; animation-delay: 1.32s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(67) { -webkit-animation-delay: 1.34s !important; animation-delay: 1.34s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(68) { -webkit-animation-delay: 1.36s !important; animation-delay: 1.36s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(69) { -webkit-animation-delay: 1.38s !important; animation-delay: 1.38s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(70) { -webkit-animation-delay: 1.4s !important; animation-delay: 1.4s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(71) { -webkit-animation-delay: 1.42s !important; animation-delay: 1.42s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(72) { -webkit-animation-delay: 1.44s !important; animation-delay: 1.44s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(73) { -webkit-animation-delay: 1.46s !important; animation-delay: 1.46s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(74) { -webkit-animation-delay: 1.48s !important; animation-delay: 1.48s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(75) { -webkit-animation-delay: 1.5s !important; animation-delay: 1.5s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(76) { -webkit-animation-delay: 1.52s !important; animation-delay: 1.52s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(77) { -webkit-animation-delay: 1.54s !important; animation-delay: 1.54s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(78) { -webkit-animation-delay: 1.56s !important; animation-delay: 1.56s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(79) { -webkit-animation-delay: 1.58s !important; animation-delay: 1.58s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(80) { -webkit-animation-delay: 1.6s !important; animation-delay: 1.6s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(81) { -webkit-animation-delay: 1.62s !important; animation-delay: 1.62s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(82) { -webkit-animation-delay: 1.64s !important; animation-delay: 1.64s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(83) { -webkit-animation-delay: 1.66s !important; animation-delay: 1.66s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(84) { -webkit-animation-delay: 1.68s !important; animation-delay: 1.68s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(85) { -webkit-animation-delay: 1.7s !important; animation-delay: 1.7s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(86) { -webkit-animation-delay: 1.72s !important; animation-delay: 1.72s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(87) { -webkit-animation-delay: 1.74s !important; animation-delay: 1.74s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(88) { -webkit-animation-delay: 1.76s !important; animation-delay: 1.76s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(89) { -webkit-animation-delay: 1.78s !important; animation-delay: 1.78s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(90) { -webkit-animation-delay: 1.8s !important; animation-delay: 1.8s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(91) { -webkit-animation-delay: 1.82s !important; animation-delay: 1.82s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(92) { -webkit-animation-delay: 1.84s !important; animation-delay: 1.84s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(93) { -webkit-animation-delay: 1.86s !important; animation-delay: 1.86s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(94) { -webkit-animation-delay: 1.88s !important; animation-delay: 1.88s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(95) { -webkit-animation-delay: 1.9s !important; animation-delay: 1.9s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(96) { -webkit-animation-delay: 1.92s !important; animation-delay: 1.92s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(97) { -webkit-animation-delay: 1.94s !important; animation-delay: 1.94s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(98) { -webkit-animation-delay: 1.96s !important; animation-delay: 1.96s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(99) { -webkit-animation-delay: 1.98s !important; animation-delay: 1.98s !important; } body #wrap:not(.loading) .number .cell:nth-of-type(100) { -webkit-animation-delay: 2s !important; animation-delay: 2s !important; } body #wrap:not(.loading) .number.number0 .cell, body #wrap:not(.loading) .number.number1 .cell, body #wrap:not(.loading) .number.number2 .cell, body #wrap:not(.loading) .number.number3 .cell, body #wrap:not(.loading) .number.number4 .cell, body #wrap:not(.loading) .number.number5 .cell, body #wrap:not(.loading) .number.number6 .cell, body #wrap:not(.loading) .number.number8 .cell, body #wrap:not(.loading) .number.number9 .cell { -webkit-animation: clip-in 1s ease-in-out 1 forwards; animation: clip-in 1s ease-in-out 1 forwards; } @-webkit-keyframes clip-in { 0% { -webkit-clip-path: polygon(0 100%, 100% 100%, 100% 100%, 0% 100%); clip-path: polygon(0 100%, 100% 100%, 100% 100%, 0% 100%); } 75% { -webkit-clip-path: polygon(0 100%, 100% 100%, 100% 100%, 0% 100%); clip-path: polygon(0 100%, 100% 100%, 100% 100%, 0% 100%); } 100% { -webkit-clip-path: polygon(0 0, 100% 0, 100% 100%, 0% 100%); clip-path: polygon(0 0, 100% 0, 100% 100%, 0% 100%); } } @keyframes clip-in { 0% { -webkit-clip-path: polygon(0 100%, 100% 100%, 100% 100%, 0% 100%); cli.........完整代码请登录后点击上方下载按钮下载查看
网友评论0