196 | CSShake 197 |
198 |199 | Some CSS classes to move your DOM! 200 |
201 | 202 | 208 |Classes
212 | 213 |The basic collection
214 |-
215 |
-
216 |
217 | Bs
218 |
219 |
220 |
Basic Shake
221 |
222 | -
223 |
224 | Ss
225 |
226 |
227 |
Slow Shake
228 |
229 | -
230 |
231 | Ls
232 |
233 |
234 |
Little Shake
235 |
236 | -
237 |
238 | Hs
239 |
240 |
241 |
Hard Shake
242 |
243 | -
244 |
245 | ⇄
246 |
247 |
248 |
Fixed Horizontal
249 |
250 | -
251 |
252 | ⇵
253 |
254 |
255 |
Fixed Vertical
256 |
257 | -
258 |
259 | ↻
260 |
261 |
262 |
Fixed Rotation
263 |
264 | -
265 |
266 | Os
267 |
268 |
269 |
Opacity Shake
270 |
271 | -
272 |
273 | ✌
274 |
275 |
276 |
Crazy Shake
277 |
278 | -
279 |
280 | ℇ
281 |
282 |
283 |
Constant Shake
284 |
285 | -
286 |
287 | %
288 |
289 |
290 |
Chunk Shake
291 |
292 |
-
295 |
- 296 |
- 297 |
- 298 |
- 299 |
- 300 |
- 301 |
- 302 |
- 304 |
- 305 |
- 306 | 307 | 308 |
- 309 |
- 310 | 313 | 314 |
- 315 | 316 | 317 |
- 318 |
- 319 |
- 321 |
- 322 |
- 323 | 326 | 327 |
- 328 |
- 329 |
- 330 |
- 331 |
303 |
320 |
333 | Launch the animations from the parent with class 'shake-trigger' 334 | (customizable) 335 |
336 | 337 |Install
341 | 342 |Get started...
343 |$ git clone https://github.com/elrumordelaluz/csshake.git
346 | 347 |
or
348 |$ bower install csshake
349 | 350 |
or
351 |$ npm i csshake
352 | 353 |
354 | or
355 | Download Center
360 |
Download separated files for each shake animation, expanded or
361 | minified.
362 |
363 | 364 | 365 | cdnjs.com 366 | New 367 | 368 |
369 | 370 |How to use
371 | 372 |Include the css file then apply classes to elements
373 |<link rel="stylesheet" type="text/css" href="csshake.min.css">
376 | <!-- or from surge.sh -->
377 | <link rel="stylesheet" type="text/css" href="https://csshake.surge.sh/csshake.min.css">
378 | 379 |
<div class="shake"></div>
382 | <div class="shake-hard"></div>
385 | <div class="shake-slow"></div>
388 | <div class="shake-little"></div>
391 | <div class="shake-horizontal"></div>
394 | <div class="shake-vertical"></div>
397 | <div class="shake-rotate"></div>
400 | <div class="shake-opacity"></div>
403 | <div class="shake-crazy"></div>
406 | <div class="shake-chunk"></div>
409 | 410 |
411 |419 |<ul class="shake-trigger">
412 |<li class="shake-slow"></li>
413 |<li></li>
414 |<li></li>
415 |<li class="shake-hard"></li>
416 |<li></li>
417 |<li class="shake"></li>
418 |</ul>
<!-- To include only some csshake animations use this syntax -->
422 | <link rel="stylesheet" type="text/css" href="csshake-slow.min.css">
423 | <!-- or from surge.sh -->
424 | <link rel="stylesheet" type="text/css" href="http://csshake.surge.sh/csshake-slow.min.css">
425 | 426 | 427 |
Variations
432 | 433 |Some things you could add...
434 |-
435 |
-
436 |
437 |
Freezed after Shake
440 |
441 |
438 |
439 | -
442 |
446 |
Constant and stops on :hover
449 |
450 |
447 |
448 |
465 |
<!-- To shake constant -->
466 | <div class="shake-slow shake-constant"></div>
467 | <!-- and stops on :hover -->
468 | <div class="shake-slow shake-constant shake-constant--hover"></div>
469 | <!-- Freeze animation at that point when :hover -->
472 | <div class="shake-crazy shake-freeze"></div>
473 |
474 | More flexibility
479 | 480 |The do-shake @mixin, and so on...
481 |.my-custom-shake {
482 | @include do-shake(
483 | $name: 'my-custom-shake', /* {String} is the name for the keyframes animation */
484 | $h: 5px, /* {Number} is the max number for random to assign in x axis */
485 | $v: 5px, /* {Number} is the max number for random to assign in y axis */
486 | $r: 3deg, /* {Number} is the max number for random rotation */
487 | $dur: 100ms, /* {Number} is the animation-duration time value */
488 | $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; */
489 | $opacity: false,
490 | $q: infinite, /* {String} is the animation-iteration-count value */
491 | $t: ease-in-out, /* {String} animation-timing-function value */
492 | $delay: null, /* {Number} animation-delay time value */
493 | $chunk: 100%); /* {Number} is the part of the keyframes where apply the animation */
494 | }
495 |
496 | /* Example shake-crazy */
497 | .shake-crazy {
498 | @include do-shake('shake-crazy', 40, 40, 20, 100ms, .1, $opacity: true);
499 | }
500 |
501 |
502 | Last words
506 | 507 |508 | The about, the idea, and the desire to hear from you to improve the 509 | code... 510 |
511 |
512 | I had to make a shake animation for a big project. I did it in vanilla
513 | CSS at the begining.
After I finished it I discovered
514 | this
519 | cool jQuery plugin by
520 | @jackrugile.
523 | Then I started to think I should make this little CSS project.
524 |
529 | Fork me on Github 534 |
535 | Tweet 541 | 554 | 561 |
562 | 572 |