css左右摇摆动画

html 复制代码
<html>
   <head>
      <style>

         .animated {
           background: red;
            padding-top:95px;
            margin-bottom:60px;
            -webkit-animation-duration: 10s;
            animation-duration: 10s;
            -webkit-animation-fill-mode: both;
            animation-fill-mode: both;
         }

         @-webkit-keyframes shake {
            0%, 100% {-webkit-transform: translateX(0);}
            10%, 30%, 50%, 70%, 90% {-webkit-transform: translateX(-10px);}
            20%, 40%, 60%, 80% {-webkit-transform: translateX(10px);}
         }

         @keyframes shake {
            0%, 100% {transform: translateX(0);}
            10%, 30%, 50%, 70%, 90% {transform: translateX(-10px);}
            20%, 40%, 60%, 80% {transform: translateX(10px);}
         }

         .shake {
            -webkit-animation-name: shake;
            animation-name: shake;
         }
      </style>

   </head>
   <body>

      <div id = "animated-example" class = "animated shake"></div>
      <button onclick = "myFunction()">Reload page</button>

      <script>
         function myFunction() {
            location.reload();
         }
      </script>
   </body>
</html>

抖动缩放动画

html 复制代码
<!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>Document</title>
    <style>
        @keyframes shake {
  0% {
    transform: scale(1);
  }
  25% {
    transform: scale(1.5) translateX(-5px) translateY(-5px);
  }
  50% {
    transform: scale(1);
  }
  75% {
    transform: scale(0.5) translateX(5px) translateY(5px);
  }
  100% {
    transform: scale(1);
  }
}

.element {
  animation: shake 1s 1;

  width: 10px;
  height: 10px;
  background: red
}
    </style>
</head>
<body>
    <div class="element">

    </div>
</body>
</html>
相关推荐
影子信息21 小时前
css 文本显示两行超过显示省略号
css
天天进步201521 小时前
CSS Grid与Flexbox:2025年响应式布局终极指南
前端·css
苏打水com21 小时前
Tailwind CSS的grid布局
css
Access开发易登软件1 天前
Access导出带图表的 HTML 报表:技术实现详解
数据库·后端·html·vba·导出·access
顾安r1 天前
11.8 脚本网页 打砖块max
服务器·前端·html·css3
用户47949283569151 天前
告别span嵌套地狱:CSS Highlights API重新定义语法高亮
前端·javascript·css
诚实可靠王大锤1 天前
WebSocket调试工具(html),用于调试WebSocket链接是否畅通
websocket·网络协议·html
会有钱的-_-1 天前
基于微信小程序的场景解决
微信小程序·小程序·css3
摇滚侠1 天前
浏览器的打印功能,如果通过HTML5,控制样式
前端·html·html5
inx1771 天前
CSS 定位详解:relative、absolute、fixed、sticky 与 static
css