• Stars
    star
    4,814
  • Rank 8,747 (Top 0.2 %)
  • Language SCSS
  • License
    MIT License
  • Created over 10 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

CSS classes to move your DOM!

CSShake npm version

Some CSS classes to move your DOM!

Live Demo

Download Center

You could download the complete csshake.css file or separated files for each shake animation (i.e csshake-little.css). Each one expanded or minified.

Why

I had to do a 'shake-animation' for a big project. First, I did it in vanilla CSS. After finish it I discover this cool jQuery plugin by @jackrugile. Then I started to think in made this little CSS project

Install

Fork this repo

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

or via Bower

  $ bower install csshake

or via npm

  $ npm i csshake

scripts

  $ npm run watch
  $ npm run build:raw
  $ npm run build:min

CDN

Now is also available in cdnjs for each shake animation: https://cdnjs.com/libraries/csshake

How to use

First include the CSS file

<link rel="stylesheet" type="text/css" href="csshake.css" />`

Then call the different classes on the element you want to shake!

<div class="shake"></div>
<div class="shake shake-hard"></div>
<div class="shake shake-slow"></div>
<div class="shake shake-little"></div>
<div class="shake shake-horizontal"></div>
<div class="shake shake-vertical"></div>
<div class="shake shake-rotate"></div>
<div class="shake shake-opacity"></div>
<div class="shake shake-crazy"></div>

Add also classes to control the animation-play-state.

<!-- Freeze the animation at that point when :hover -->
<div class="shake shake-freeze"></div>
<!-- Continuous animation instead on :hover -->
<div class="shake shake-constant"></div>
<!-- and stop when :hover -->
<div class="shake shake-constant shake-constant--hover"></div>

Customize

You could customize the Sass @mixins to create new shaking animations, yeah! Editing the do-shake mixin in scss/_tools.scss file

.my-custom-shake {
  @include do-shake(
    $name: 'my-custom-shake',
    $h: 5px,
    $v: 5px,
    $r: 3deg,
    $dur: 100ms,
    $precision: 0.02,
    $opacity: false,
    $q: infinite,
    $t: ease-in-out,
    $delay: null,
    $chunk: 100%
  );
}

$name {String} is the name for the keyframes animation

$h {Number} is the max number for random to assign in x axis

$v {Number} is the max number for random to assign in y axis

$r {Number} is the max number for random rotation

$dur {Number} is the animation-duration time value

$precision {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 {Boolean} to apply random animation also in the opacity property

$q {String} is the animation-iteration-count value

$t {String} animation-timing-function value

$delay {Number} animation-delay time value

$chunk {Number} is the part of the keyframes where apply the animation

Use with Webpack 2.x

When installed with npm, import csshake inside your css|stylus|sass files with ~ prefix to trigger webpack's module resolving:

@import '~csshake';

This will get you non-minified plain css.

Import source sass files

Include full path relative to your node_modules folder with csshake installation

@import '~csshake/scss/csshake-hard.scss';

=======

Changelog

v1.5.0 (October 5, 2015)

  • Improve the core mixin for a better output code
  • Generate the entire 'shake' animation from only one @mixin. Easier to cerate custom shakes animations classes.
  • Add a new argument to allow animate only part of the 100% of keyframes. Solves issue #25
  • Add a class to allow fire animation from a parent element. Solves issue #16
  • Update semanthics on modifiers classes
  • Export separated stylesheets for each animation. Solves issue #20

======

Made with β™₯ by @elrumordelaluz using Sass.

More Repositories

1

reactour

Tourist Guide into your React Components
TypeScript
3,787
star
2

svgson

Transform svg files to json notation
JavaScript
412
star
3

reshake

CSShake as a React Functional Component
TypeScript
267
star
4

svgsprit.es

Public endpoint to generate SVG Sprites using svg-spreact
JavaScript
153
star
5

draGGradients

A simple tool to generate and customize multiple css3 radial gradients.
JavaScript
138
star
6

outline-stroke

Convert stroked SVG into the outlined version
JavaScript
121
star
7

coloreact

A tiny Color Picker for React
JavaScript
88
star
8

Pixelator

A really simple tool to generate one element css box-shadow pixel style.
JavaScript
61
star
9

path-that-svg

Path that SVG!
JavaScript
56
star
10

element-to-path

Transform SVG elements into path
JavaScript
46
star
11

outline-stroke-cli

Convert stroked SVG into the outlined version
JavaScript
32
star
12

svg-path-tools

Tools to manipulate svg path (d)
JavaScript
26
star
13

Sassisfaction

Awesome Sass Resources
JavaScript
21
star
14

scale-that-svg

Scale that SVG!
JavaScript
19
star
15

svg-spreact-cli

CLI version of svg-spreact
JavaScript
19
star
16

svg-spreact

Create svg sprites using svgson and react
JavaScript
16
star
17

svgson-next

Deprecated: use [email protected] instead
JavaScript
15
star
18

svgson-cli

CLI version of svgson
JavaScript
14
star
19

tablexcel

Convert Excel tables in HTML code
11
star
20

micro-outline-stroke

UI and endpoint for svg-outline-stroke
JavaScript
10
star
21

newbancomail

Useful style package to use in projects.
CSS
10
star
22

elrumordelaluz

My website
JavaScript
6
star
23

my-css-guidelines

My personal CSS coding guidelines
5
star
24

iterm-tab

Open Item2 tab programatically from NodeJS
JavaScript
4
star
25

ministarter

Starter configuration for fast static web projects
JavaScript
3
star
26

telegram-translate-bot

A Telegram Bot to Translate into Italian
JavaScript
3
star
27

next-with-apollo-custom-app

JavaScript
2
star
28

responsimage

JavaScript
2
star
29

expresstart

Simple Express server starting files
JavaScript
1
star
30

react-braintree-custom-dropin

JavaScript
1
star
31

css-props

W3C List of CSS properties, both proposed and standard
JavaScript
1
star
32

tryExec

Exec an npm script trying several times in case a condition doesn't meets
JavaScript
1
star
33

fsvg

fsvg πŸ’€
JavaScript
1
star
34

vercel-test-sharp-svg-fonts

JavaScript
1
star