로딩 애니메이션 효과를 구현하기 위해 CSS3를 사용한 코드 사례 공유

黄舟
풀어 주다: 2017-05-25 10:14:46
원래의
2126명이 탐색했습니다.

로딩 애니메이션 효과를 구현하기 위해 CSS3를 사용한 코드 사례 공유

코드는 다음과 같습니다.

<!DOCTYPE html><html><head>
    <meta charset="UTF-8">
    <title>css3 loading等待加载代码 - 何问起</title>

    <style>
        @keyframes move {
            from {
                transform: translate(0,50%);
            }

            to {
                transform: translate(0,850%);
            }
        }

        * {
            margin: 0;
            padding: 0;
        }

        body {
            min-width: 325px;
            height: 100vh;
            display: flex;
            flex-wrap: wrap;
            justify-content: space-around;
            align-items: center;
            align-content: flex-start;
            background: #2a2a2a;
        }

        figure {
            margin: 30px;
            width: 250px;
            height: 250px;
            border-radius: 50%;
            position: relative;
            background: #1c1c1c;
        }

        section {
            width: 10%;
            height: 100%;
            position: absolute;
            left: 45%;
        }

            section:nth-child(2) {
                transform: rotate(22.5deg);
            }

            section:nth-child(3) {
                transform: rotate(45deg);
            }

            section:nth-child(4) {
                transform: rotate(67.5deg);
            }

            section:nth-child(5) {
                transform: rotate(90deg);
            }

            section:nth-child(6) {
                transform: rotate(112.5deg);
            }

            section:nth-child(7) {
                transform: rotate(135deg);
            }

            section:nth-child(8) {
                transform: rotate(157.5deg);
            }

        figure p {
            height: 10%;
            border-radius: 50%;
            background: dodgerblue;
            animation: move 1s ease-in-out infinite alternate;
        }

        figure:nth-child(1) > section:nth-child(1) > p {
            animation-delay: -0.1875s;
        }

        figure:nth-child(1) > section:nth-child(2) > p {
            animation-delay: -0.175s;
        }

        figure:nth-child(1) > section:nth-child(3) > p {
            animation-delay: -0.1625s;
        }

        figure:nth-child(1) > section:nth-child(4) > p {
            animation-delay: -0.15s;
        }

        figure:nth-child(1) > section:nth-child(5) > p {
            animation-delay: -0.9375s;
        }

        figure:nth-child(1) > section:nth-child(6) > p {
            animation-delay: -0.925s;
        }

        figure:nth-child(1) > section:nth-child(7) > p {
            animation-delay: -0.9125s;
        }

        figure:nth-child(1) > section:nth-child(8) > p {
            animation-delay: -0.9s;
        }

        figure:nth-child(2) > section:nth-child(1) > p {
            animation-delay: -0.875s;
        }

        figure:nth-child(2) > section:nth-child(2) > p {
            animation-delay: -0.75s;
        }

        figure:nth-child(2) > section:nth-child(3) > p {
            animation-delay: -0.625s;
        }

        figure:nth-child(2) > section:nth-child(4) > p {
            animation-delay: -0.5s;
        }

        figure:nth-child(2) > section:nth-child(5) > p {
            animation-delay: -0.375s;
        }

        figure:nth-child(2) > section:nth-child(6) > p {
            animation-delay: -0.25s;
        }

        figure:nth-child(2) > section:nth-child(7) > p {
            animation-delay: -0.125s;
        }

        figure:nth-child(3) > section:nth-child(1) > p {
            animation-delay: -0.5s;
        }

        figure:nth-child(3) > section:nth-child(3) > p {
            animation-delay: -0.5s;
        }

        figure:nth-child(3) > section:nth-child(5) > p {
            animation-delay: -0.5s;
        }

        figure:nth-child(3) > section:nth-child(7) > p {
            animation-delay: -0.5s;
        }

        figure:nth-child(4) > section:nth-child(1) > p {
            animation-delay: -0.35s;
        }

        figure:nth-child(4) > section:nth-child(2) > p {
            animation-delay: -0.3s;
        }

        figure:nth-child(4) > section:nth-child(3) > p {
            animation-delay: -0.25s;
        }

        figure:nth-child(4) > section:nth-child(4) > p {
            animation-delay: -0.2s;
        }

        figure:nth-child(4) > section:nth-child(5) > p {
            animation-delay: -0.15s;
        }

        figure:nth-child(4) > section:nth-child(6) > p {
            animation-delay: -0.1s;
        }

        figure:nth-child(4) > section:nth-child(7) > p {
            animation-delay: -0.05s;
        }
    </style>

    <script src="js/prefixfree.min.js"></script></head><body>

    <figure>
        <section><p></p></section>
        <section><p></p></section>
        <section><p></p></section>
        <section><p></p></section>
        <section><p></p></section>
        <section><p></p></section>
        <section><p></p></section>
        <section><p></p></section>
    </figure>

    <figure>
        <section><p></p></section>
        <section><p></p></section>
        <section><p></p></section>
        <section><p></p></section>
        <section><p></p></section>
        <section><p></p></section>
        <section><p></p></section>
        <section><p></p></section>
    </figure>

    <figure>
        <section><p></p></section>
        <section><p></p></section>
        <section><p></p></section>
        <section><p></p></section>
        <section><p></p></section>
        <section><p></p></section>
        <section><p></p></section>
        <section><p></p></section>
    </figure>

    <figure>
        <section><p></p></section>
        <section><p></p></section>
        <section><p></p></section>
        <section><p></p></section>
        <section><p></p></section>
        <section><p></p></section>
        <section><p></p></section>
        <section><p></p></section>
    </figure>

    <p style="text-align:center;margin:50px 0; font:normal 14px/24px &#39;MicroSoft YaHei&#39;;">
        <p>适用浏览器:360、FireFox、Chrome、Opera、傲游、搜狗、世界之窗. 不支持Safari、IE8及以下浏览器。</p>
        <p>来源:<a href="http://hovertree.com/" target="_blank">何问起</a></p>
    </p></body></html>
로그인 후 복사

위 내용은 로딩 애니메이션 효과를 구현하기 위해 CSS3를 사용한 코드 사례 공유의 상세 내용입니다. 자세한 내용은 PHP 중국어 웹사이트의 기타 관련 기사를 참조하세요!

관련 라벨:
원천:php.cn
본 웹사이트의 성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.
최신 이슈
인기 튜토리얼
더>
최신 다운로드
더>
웹 효과
웹사이트 소스 코드
웹사이트 자료
프론트엔드 템플릿
회사 소개 부인 성명 Sitemap
PHP 중국어 웹사이트:공공복지 온라인 PHP 교육,PHP 학습자의 빠른 성장을 도와주세요!