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>
相关推荐
Dragon Wu39 分钟前
TailWindCss 核心功能总结
前端·css·前端框架·postcss
lcc18743 分钟前
CSS 隐藏元素的方式
css
Han.miracle9 小时前
CSS 核心基础:样式表与选择器入门
css
hid7117136620 小时前
STM32F0 打造高性能无感 FOC 无刷电机控制方案,挑战 VESC 成本极限
css
软件技术NINI20 小时前
娃娃店html+css 4页
前端·css·html
武清伯MVP1 天前
CSS Grid布局全解析:从基础到实战的二维布局方案
前端·css·grid
BD_Marathon1 天前
Vue3_关于CSS样式的导入方式
前端·css
相闻秋歌1 天前
六、背景相关属性
css·html5
枫子有风1 天前
Day6 前端开发(from teacher;HTML,CSS,JavaScript,Web APIs,Node.js,Vue)
javascript·css
霍理迪2 天前
基础CSS语法
前端·css