본문 바로가기
Web/HTML | CSS|JAVASCRIPT

transfrom, keyframes 도형 회전하기(HTML, CSS)

by 싸공 2020. 7. 18.
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<style>
    *{
        margin0;
        padding0;
        box-sizingborder-box;
    }
    .wi{
        justify-contentcenter;
        align-itemscenter;
        width100%;
        height100%;
        top50%;
        left50%;
        background-color#6e6438;
        positionabsolute;
        transformtranslate(-50%-50%);
        displayflex;
    }
    .box{
        width200px;
        height200px;
        animation: rotate 2.5s infinite;
        backgroundlinear-gradient(to rightrgb(909223150%#f16d6d 50%);
        background-size200% 100%;
        background-position:right bottom;
        transformrotate(-90deg);
        border-radius15%;
    }
    @keyframes rotate{
        0%{ 
            background-positionright bottom;
        }
        50%{
            background-positionleft bottom;
            transformrotate(90deg);
        }
        100%{
            background-positionright bottom;
            transformrotate(270deg);

        }
    }
</style>
<body>
        <div class="wi">
            <div class="box"></div>
        </div>
</body>
</html>