css实现快速抖动效果_CSShake 使用 CSS3 实现各种抖动效果 - 文章

CSShake是一款基于CSS3的动画库,使用SASS编写,提供了丰富的抖动效果。该库包含9种抖动样式及3种状态变化,适用于广告、图片和按钮等元素,以吸引用户注意并增加交互性。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

CSShake 是一个使用 CSS3 实现的动画样式,使用 SASS 编写,利用它我们可以实现多种不同样式的抖动效果。

CSShake 是一个很微小的动画,但使用得当也是挺不错的,比如用在广告、图像、按钮上,这样可以用来吸引用户眼球从而促使去点击它。这个csshake有9个抖动样式,三个状态,如鼠标经过拉动、无限抖动、鼠标悬停拉动。

16dedbe71d5fa2d0e267fc59c705c249.png

安装方法

$ git clone https://github.com/elrumordelaluz/csshake.git

$ bower install csshake

$ npm i csshake

以上方法,任选其一即可。

使用方法

包括 CSS 文件,然后将类应用于元素

要只包含一些csshake动画,请使用以下语法:

摇动常数

在以下时间冻结动画,直到鼠标悬停。

更多效果

你可以根据自己的需要,添加自己的效果:

.my-custom-shake {

@include do-shake(

$name: 'my-custom-shake', /* {String} is the name for the keyframes animation */

$h: 5px, /* {Number} is the max number for random to assign in x axis */

$v: 5px, /* {Number} is the max number for random to assign in y axis */

$r: 3deg, /* {Number} is the max number for random rotation */

$dur: 100ms, /* {Number} is the animation-duration time value */

$precision: .02, /* {Number} is the precision of the keyframes animation. For example .02 generates keyframes each 2% and .1 each 10%. The calculation is $step: 100 * $precision; */

$opacity: false,

$q: infinite, /* {String} is the animation-iteration-count value */

$t: ease-in-out, /* {String} animation-timing-function value */

$delay: null, /* {Number} animation-delay time value */

$chunk: 100% /* {Number} is the part of the keyframes where apply the animation */

);

}

/* Example shake-crazy */

.shake-crazy {

@include do-shake('shake-crazy', 40, 40, 20, 100ms, .1, $opacity: true);

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值