ブログの投稿ログ

2021年
9月
8月
7月
6月

ブルブルするアニメーション

今日は要素をブルブルさせていきたいと思います!

でも

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>Static Template</title>
  </head>
  <body>
    // ブルブルする要素
    <h1 class="hoge">ブルブル</h1>
  </body>
  <style>
    // アニメーションを定義
    @keyframes anm04 {
      0% {
        transform: translate(0px, 0px) rotateZ(0deg);
      }
      25% {
        transform: translate(2px, 2px) rotateZ(1deg);
      }
      50% {
        transform: translate(0px, 2px) rotateZ(0deg);
      }
      75% {
        transform: translate(2px, 0px) rotateZ(-1deg);
      }
      100% {
        transform: translate(0px, 0px) rotateZ(0deg);
      }
    }
    .hoge {
      padding-top: 40px;
      text-align: center;
      cursor: pointer;
      // アニメーションを付与
      animation: anm04 0.15s infinite;
    }
  </style>
</html>