CSS3-钟摆练习

114 阅读1分钟

摇摆_编辑.gif

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

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        body {
            background-color: black;
        }

        div {
            width: 300px;
            height: 10px;
            border-radius: 50%;
            /* border: 1px solid white; */
            position: absolute;
            top: 50%;
            left: 50%;
            background-color: white;
            transform-origin: 0 5px;
            /* transform: rotate(60deg); */
            animation: clock 2s cubic-bezier(0.5, 0, 0.5, 1) infinite alternate;
            /*  */

        }

        div::after {
            position: absolute;
            content: '';
            width: 50px;
            height: 50px;
            background-color: white;
            border-radius: 50%;
            border: 1px solid white;
            box-shadow: 0 0 30px 15px white,
                0 0 80px 50px yellow;
            left: 275px;
            bottom: -20px;
        }

        @keyframes clock {
            0% {
                transform: rotate(30deg);
            }

            100% {
                transform: rotate(150deg);
            }
        }
    </style>
</head>

<body>
    <div></div>
</body>

</html>