css 文字左右抖动效果

html 复制代码
<template>
  <div class="box">
    <div class="shake shape">抖动特效交字11</div>
  </div>
</template>

<script setup></script>

<style scope>
.shape {
    margin: 50px;
    width: 200px;
    height: 50px;
    line-height: 50px;
    text-align: center;
    border: 1px solid black;
 }


.shake:hover {
    animation: shakeAnimal 800ms ease-in-out;
}
@keyframes shakeAnimal { /* 水平抖动,核心代码 */
    10%, 90% { transform: translate3d(-1px, 0, 0); }
    20%, 80% { transform: translate3d(+2px, 0, 0); }
    30%, 70% { transform: translate3d(-4px, 0, 0); }
    40%, 60% { transform: translate3d(+4px, 0, 0); }
    50% { transform: translate3d(-4px, 0, 0); }
}

</style>
相关推荐
ApeAssistant13 小时前
你有疑惑过 CSS 中 transform: translate() 和 position: relative 的区别吗?🧐
css
中微子13 小时前
在 CSS 中画三角形,最常用的两种方法是使用 边框 (Border) 或 裁剪路径 (Clip-path)。
css
青鸟北大也是北大16 小时前
CSS单位与字体样式全解析
前端·css·html
王同学_11617 小时前
爬虫辅助技术(css选择器、xpath、正则基础语法)
前端·css·爬虫
En^_^Joy17 小时前
CSS常用属性速查手册
前端·css
lcc18718 小时前
CSS3 新增边框属性
css
软件技术NINI1 天前
JavaScript性能优化实战指南
前端·css·学习·html
xhxxx1 天前
从样式到结构:TailwindCss + Fragment 如何让 React 代码更干净、更高效
前端·css·react.js
不染尘.2 天前
应用层之WWW
服务器·javascript·css·网络·网络协议·计算机网络·html