버튼 pulse 애니메이션 적용하기

SEUNGTAE CHOI·2024년 12월 21일

퍼블리싱

목록 보기
1/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>
    <script src="https://cdn.tailwindcss.com"></script>
    <link href="https://cdn.jsdelivr.net/npm/daisyui@4.12.10/dist/full.min.css" rel="stylesheet" type="text/css" />

    <style>
        #btn--cta::after {
            content: "";
            position: absolute;
            background-color: rgba(255, 255, 255, 0.3);
            border-radius: 50%;
            pointer-events: none;
            top: 50%;
            left: 50%;
            width: 5px;
            height: 5px;
            opacity: 0;
            transform: translate(-50%, -50%) scale(1);
            transition: opacity 1s, transform 0.5s ease-out;
        }

        #btn--cta:active::after {
            opacity: 1;
            transform: translate(-50%, -50%) scale(100);
            transition: transform 0.5s ease-out;
        }
    </style>
</head>
<body class="w-screen h-screen flex justify-center items-center">

    <button id="btn--cta" class="btn btn-primary m-auto">버튼</button>

</body>
</html>
profile
겪은 이슈를 공유합니다.

0개의 댓글