css实现数字三维翻转组合动画效果代码

代码语言:html

所属分类:动画

代码描述:css实现数字三维翻转组合动画效果代码

代码标签: 三维 翻转 组合 动画 效果

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en">

<head>

    <meta charset="UTF-8">

    <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">

    <link rel='stylesheet' href='https://fonts.googleapis.com/css2?family=Hind:wght@400&amp;display=swap'>
    <link rel='stylesheet' href='https://fonts.googleapis.com/css2?family=B612+Mono:wght@400;700&amp;display=swap'>

    <style>
        * {
            border: 0;
            box-sizing: border-box;
            margin: 0;
            padding: 0;
        }
:root {
            --hue: 223;
            --bg: hsl(var(--hue),10%,90%);
            --fg: hsl(var(--hue),10%,10%);
            --inputBg: hsl(var(--hue),10%,80%);
            --inputBdr: hsl(var(--hue),10%,70%);
            --inputCheck: hsl(var(--hue),90%,55%);
            --primary: hsl(var(--hue),90%,55%);
            font-size: calc(16px + (20 - 16) * (100vw - 320px) / (1280 - 320));
        }
        body, input {
            color: var(--fg);
            font: 1em/1.5 Hind, sans-serif;
        }
        body {
            background: var(--bg);
            display: grid;
            place-items: end center;
            height: 100vh;
            perspective: 800px;
        }
        form {
            display: flex;
            justify-content: center;
            align-items: center;
            margin-bottom: 2em;
        }
        label, input[type="checkbox"] {
            cursor: pointer;
        }
        label {
            transform: translate3d(0,0.1em,0);
        }
        input {
            background: var(--inputBg);
            border-radius: 0.2em;
            box-shadow: 0 0 0 2px var(--inputBdr) inset;
            transition: box-shadow 0.1s linear;
            -webkit-appearance: none;
            appearance: none;
        }
        input:focus {
            box-shadow: 0 0 0 2px var(--primary) inset;
            outline: none;
        }
        input[type="number"] {
            margin-right: 1.5em;
            padding: 0.5em 0.75em;
            width: 5.25em;
        }
        input[type="checkbox"] {
            margin-right: 0.375em;
            text-align: center;
            width: 1em;
            height: 1em;
        }
        input[type="checkbox"]:checked:before {
            color: var(--inputCheck);
            content: "\2713";
            display: block;
            line-height: 1.33;
        }
        input[type="checkbox"]:checked ~ .can {
            transform: rotate(-90deg);
        }
        .can, .can__sector, .sr {
            position: absolute;
        }
        .can {
            top: calc(50% - 7.25em);
            left: calc(50% - 8.5em);
            width: 17em;
            height: 10em;
            transform-style: preserve-3d;
            transition: transform 0.3s ease-in-out;
            z-index: -1;
        }
        .can__sector {
            animation: spin 18s linear infinite;
            background: linear-gradient(var(--fg)10%,var(--bg) 90%);
            -webkit-background-clip: text;
            -webkit-text-fill-color: #0000;
            font: bold 5em/1 "B612 Mono", monospace;
            text-align: center;
            bottom: 50%;
            left: 0;
            transform-origin: 50% 100%;
            width: 100%;
        }
        .can__sector:nth-child(2) {
            animation-delay: -1s
        }
        .can__sector:nth-child(3) {
            animation-delay: -2s
        }
        .can__sector:nth-child(4) {
            animation-delay: -3s
        }
        .can__sector:nth-child(5) {
            animation-delay: -4s
        }
        .can__sector:nth-child(6) {
            animation-delay: -5s
        }
        .can__sector:nth-child(7) {
            animation-delay: -6s
        }
        .can__sector:nth-child(8) {
            animation-delay: -7s
        }
        .can__sector:nth-child(9) {
            animation-delay: -8s
        }
        .can__sector:nth-child(10) {
            animation-delay: -9s
        }
        .can__sector:nth-child(11) {
            animation-delay: -10s
        }
        .can__sector:nth-child(12) {
            animation-delay: -11s
        }
        .can__sector:nth-child(13) {
            animation-delay: -12s
        }
        .can__sector:nth-child(14) {
            animation-delay: -13s
        }
        .can__sector:nth-child(15) {
            animation-delay: -14s
        }
        .can__sector:nth-child(16) {
            animation-delay: -15s
        }
        .can_.........完整代码请登录后点击上方下载按钮下载查看

网友评论0