用CSS写一个血轮眼

<!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>中间有惊喜</title>
    <style>
        body {
            height: 700px;
            /* background-image: linear-gradient(to right, white, black, white); */
            background-color: black;
            padding-top: 250px;
            box-sizing: border-box;
            overflow: hidden;
        }

        .eye {
            height: 200px;
            width: 200px;
            margin: 0 auto;
            border-radius: 50%;
            /* margin-top: 200px; */
            padding-top: 50px;
            box-sizing: border-box;
            background-color: black;
            transition: all 1s 1s;
            
            animation-play-state:paused;
        }
        .eye:hover{
            animation-play-state:running ;
            animation: bg 1s linear infinite alternate ;
        }
        @keyframes bg{
            0%{
                background-color: black;
            }
            
            /* 50%{
                background-color: red;
                opacity: .6;
            } */
            50%{
                background-color: red;
                opacity: .5;
            }
            100%{
                background-color: red;
                opacity: 1;
            }
        }


        .redeye {
            height: 100px;
            width: 100px;
            margin: 0 auto;
            border-radius: 50%;
            padding-top: 25px;
            box-sizing: border-box;
            /* background-color: red; */
            position: relative;
        }

        .qq {
            width: 50px;
            height: 50px;
            margin: 0 auto;
            border-radius: 50%;
            background-color: black;
        }

        .gouyu {

            position: absolute;
            left: -5px;
            width: 15px;

            height: 15px;

            border-radius: 50%;

            background-color: black;
        }

        .gouyu::after {

            content: '';

            position: absolute;

            top: -6px;

            left: 0px;

            width: 6px;

            height: 20px;

            border-radius: 50%;
            transform: rotate(18deg);
            border-left: 6px solid black;
        }

        .gouyu2 {
            position: absolute;
            top: 25px;
            right: -5px;
        
            width: 15px;
            height: 15px;
            border-radius: 50%;
            transform: rotate(150deg);
            background-color: black
        }
 
        .gouyu2::after {
            content: '';

            position: absolute;

            top: -6px;

            left: -1px;

            width: 6px;

            height: 20px;

            border-radius: 50%;

            border-left: 6px solid black;
        }

        .gouyu3 {

            position: absolute;
            /* top: 1px; */
            bottom: -7px;
            left: 43px;
            /* top: 80px; */
            width: 15px;
            height: 15px;
            border-radius: 50%;
            transform: rotate(213deg);
            background-color: black;
        }

        .gouyu3::after {

            content: '';

            position: absolute;

            top: -6px;

            left: -1px;

            width: 6px;

            height: 20px;

            border-radius: 50%;

            border-left: 6px solid black;
        }
        /* .eye:hover{
            background-color: red;
        } */
        
    </style>
</head>

<body>
    <div class="eye">

        <div class="redeye">
            <div class="gouyu "></div>
            <div class="gouyu2 "></div>
            <div class="gouyu3 "></div>
            <div class="qq"></div>
        </div>
    </div>
</body>

</html>

 

posted @ 2022-08-10 09:52  奇思妙想流川枫  阅读(61)  评论(0)    收藏  举报