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>
相关推荐
打呵欠的猫38 分钟前
我用 AI 把 CSS 从"每人一种风格"统一成了设计系统 Token,再也不吵"用什么颜色"了
css·ai编程
GuWenyue6 小时前
z-index 写到 9999 还是被盖住:把层叠上下文的 6 个反例全复现了一遍
前端·css·浏览器
qinqinzqq9 小时前
CSS Grid 命名区域布局:组件 Header / Content / Sider 两栏布局实践
前端·css
Mh18 小时前
基于踩过的坑,浅聊一下vh、svh、lvh、dvh
前端·css·设计模式
金八梭7 天前
格斗对决v4.5
前端·css·自动化·html·css3
CappuccinoRose9 天前
前端开发交互体系 - 汇总篇
开发语言·前端·javascript·css·html·交互
inksci11 天前
用飞帆做了个小网页
前端·javascript·css·html
星云_byto11 天前
CSS面试题
前端·css
科研邪修法12 天前
PDF新增页面文字与文本批注怎么区分?以双版本培训讲义为例
前端·css·pdf
狮子座的男孩12 天前
html+css基础:31、响应式布局(媒体类型,媒体特性,运算符,常用阈值)
前端·css·经验分享·html·响应式布局·媒体类型/特性·常用阈值