CSS classes to move your DOM!

Overview

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.

Comments
  • It's not shaking in Chrome

    It's not shaking in Chrome

    Hi, I just downloaded your csshake.min.css, it's working fine in Internet Explorer and FireFox, but it's not working in Chrome, any finx for this will be appreciated. Thanks

    opened by mlotfi2005 6
  • Missing: Harlem Shake

    Missing: Harlem Shake

    That is to say, nearly no shaking for 15 seconds followed by a fairly intense shake... except for the first element, which should shake intensely the whole time.

    opened by lgarron 5
  • package.json not pointing right to main files

    package.json not pointing right to main files

    Please update your package.json properties to point to your directories and main files. Automatic bundlers like webpack and such cannot find your "module", so we need to copy it to project files to get collected by webpack properly. Probably your initial target audience was bower-users, but npm-guys also deserve your blessed lib :)

    Асtually it seemes i don't know good solution to point to style files in package.json (maybe there is still no good one), maybe use antoher fields.. maybe investigate how bootstrap do it (they obviously had to invent something to point all possible bundlers to it's stylesheets in the first place)

    opened by antivitla 3
  • Fixed wrong interpretation of short animation rule by MS Edge

    Fixed wrong interpretation of short animation rule by MS Edge

    Hi!

    I noticed that animations go haywire in MS Edge, and after chasing down the cause, it turns out it is not interpreting the abbreviated version of the rule like other browsers do. So I made this small change that fixes it.

    opened by AlphaGit 3
  • Laggy Animation

    Laggy Animation

    Hi, I have tried using this cool css lib on my asp.net MVC5 web page.

    The animations does not seem smooth, as in very laggy so it doesnt have a "shake" effect at all it just seem odd, but on your example page it works perfect with the same browser.

    So I am wondering what might be the cause for this laggy animation (not smooth) ?

    opened by furier 3
  • $opacity is not in the documentation and not in the comment for do-shake()

    $opacity is not in the documentation and not in the comment for do-shake()

    in _tool.scss opacity is missing from the comments it is also missing in the readme

    /// Do The Shake /// @param {String} $name ['shake'] - Name for the keyframes animation /// @param {Number} $h [5px] - Max number for random to assign in x axis /// @param {Number} $v [5px] - Max number for random to assign in y axis /// @param {Number} $r [3deg] - Max number for random rotation /// @param {Number} $dur [100ms] - animation-duration; valid time value /// @param {Number} $precision [.1] - Precision of the keyframes animation (i.e 2 > 2%, 4%, 6%...) /// @param {String} $q [infinite] - animation-iteration-count; valid value /// @param {String} $t [infinite] - animation-timing-function; valid value /// @param {Number} $delay [null] - animation-delay; valid time value /// @param {Number} $chunk [100%] - Part of 100% where apply the animation @mixin do-shake( $name: 'shake', $h: 5px, $v: 5px, $r: 3deg, $dur: 100ms, $precision: .02, $opacity: false, $q: infinite, $t: ease-in-out, $delay: null, $chunk: 100% ) {

    opened by williamli 3
  • Bower.json shouldn't list both normal & minificated version of the library main file

    Bower.json shouldn't list both normal & minificated version of the library main file

    The main property of the bower.json file shouldn't list both the normal and the minificated version of the main file. Like most popular library out there like angular, lodash, jquery. This way it's easier to work with tools like Wiredep. For exemple wiredep would list all main file, here csshake.css & csshake.min.css which result in duplicate.

    opened by sapher 3
  • Shake effect on hover in safari browser

    Shake effect on hover in safari browser

    we got a problem with shake only on hover in safari browsers, the same problem i found on your page on section "variation". The first example "Freezed after Shake" doesnt work in safari 11.0.1. On our Website, it has more objects with this effect, only the first one shake. we hope u can fix it.

    help wanted 
    opened by graphi-x 2
  • Make CSSshake stylesheet link HTTPS

    Make CSSshake stylesheet link HTTPS

    The demos on the page don't currently work in Chrome 54 and other browsers since the github pages site is loaded over HTTPS, but the stylesheet isn't. This proposed change fixes that so the demos work again!

    opened by aboutaaron 2
  • [request] new release (npm)

    [request] new release (npm)

    In 1.5.0 the apply-random function is defined within the do-shake mixin. In master you have it defined outside of the do-shake mixin. Chances are the change in master is to address Sass compilers barking Functions may not be defined within control directives or other mixins.

    Is it possible to make a new release with the patch that is contained in master?

    Thanks!

    opened by greaterweb 2
  • Add dedicated CSS style for the default

    Add dedicated CSS style for the default "shake" class

    shake-little, shake-slow and others have dedicated CSS files for very light-weight integration into existing projects (in the dist directory). However, no dedicated CSS file is present for the shake class. It is available only in the 21kb file which contains all the classes. I suggest adding a new file csshake-default.css and csshake-default.min.css to cover the shake class if someone is not interested in the other shake variants.

    opened by paya-cz 2
  • A new idea makes csshake more perfect

    A new idea makes csshake more perfect

    I'm currently using the plug-in, and I have encountered a problem, but the simple jitter is not enough to meet the requirements. If it is always jittering, it will be visually fatigued, which is not conducive to good interface design. Therefore, I want csshake to be able to configure interval jitter. I referenced the csshake.css file in my file and used it in the div. It works perfectly, but I want the div to stop shaking for a period of time, and then start shaking after 1 second (configurable). Use This plug-in is very convenient, but I am not a professional programmer. How can I realize interval jitter? Thank you again for writing such a great thing, and I look forward to the changes in csshake to make it better!

    opened by aryayang 0
🤖 Tailwind CSS assistant helps you to edit classes (includes JIT & ignores purge), toggle breakpoint classes on an element and view current breakpoint

Tailwind CSS Assistant See it in action on this example website ?? ✅ Small JavaScript package that helps you work with Tailwind CSS by... Showing you

Mark Mead 30 Dec 28, 2022
Custom Vitest matchers to test the state of the DOM, forked from jest-dom.

vitest-dom Custom Vitest matchers to test the state of the DOM This library is a fork of @testing-library/jest-dom. It shares that library's implement

Chance Strickland 14 Dec 16, 2022
An extension of DOM-testing-library to provide hooks into the shadow dom

Why? Currently, DOM-testing-library does not support checking shadow roots for elements. This can be troublesome when you're looking for something wit

Konnor Rogers 28 Dec 13, 2022
Smart Auto Move learns the size and position of your application windows and restores them to the correct place on subsequent launches. Supports GNOME Wayland.

smart-auto-move smart-auto-move is a Gnome Shell extension which keeps track of all application windows and restores them to the previous position, si

khimaros 40 Dec 23, 2022
An npm package with Tailwind CSS utility classes for creating responsive grid columns without media queries using auto fit.

Grid Auto Fit for Tailwind CSS A plugin that helps you create a responsive grid layout in Tailwind CSS without using media queries. It uses the auto-f

Thirus 80 Dec 28, 2022
Move all the disks from the left hand post to the right hand post, only moving the disks one at a time and a bigger disk can never be placed on a smaller disk.

Hanoi Tower Description The Tower of Hanoi was a famous problem posed by a mathematician in 1883, The "puzzle" is to move all the disks from the left

Dustin J Sellers 1 Feb 5, 2022
A dedicated desktop app that enables you to move items in and out of storage units in CSGO.

CASEMOVE Casemove is an open-source desktop application that helps you easily move items out of and into Storage Units in Counter-Strike: Global Offen

null 161 Dec 24, 2022
Custom events 'movestart', 'move' and 'moveend' for jQuery.

#jquery.event.move Move events provide an easy way to set up press-move-release interactions on mouse and touch devices. UPDATE 2.0: move events are n

stephband 257 Apr 20, 2022
Generated TypeScript interfaces for Aptos Move.

Aptos Framework TypeScript SDK Generated TypeScript interfaces for Aptos Move. This contains types for: AptosFramework MoveNursery MoveStdlib Releases

Aptosis 7 Aug 25, 2022
An enhanced VSCode extension for the Move programming language.

Move Analyzer Plus Provides language support for the Move programming language. Install on the VSCode Extension Marketplace: Move Analyzer Plus on the

The Moving Company 10 Aug 12, 2022
A to-do-list project is about keeping the track of all the daily task. This application can add move or delete task.

TO-DO LIST This is a project that create a simple todo tool that help you organize your day. This is build using ES6 and webpack. Built With HTML CSS

suzana marsela 8 Oct 26, 2022
js move playground by imcoding.online

JS MOVE PLAYGROUND Wrapper move playground by pontem. Only support Browser environment. Demo imcoding.online Install npm i @imcoding.online/js-move-pl

imcoding.online 14 Dec 3, 2022
A Chess learning tool where you have to find a top-engine move in a random position.

Just A Chess Move A Chess learning tool where you have to find a top-5 move in a random position. There aren't necessarily any tactics, you have to ju

Daan Heskes 14 Sep 18, 2022
ALU Map is a web-based platform that will help students move around ALU Rwanda Campus.

ALU-MAP ALU Map is a web-based platform that will help students move around ALU Rwanda Campus. Introduction Please refer to CONTRIBUTING.md for contri

null 5 Oct 25, 2022
Small library to create classes without using class syntax.

Clazz.js Small library to create classes without using class syntax. Compatibility For internet explorer 11 or higher. Example <script src="Clazz.js">

Emanuel R. Vásquez 1 Dec 25, 2021
Dm-utils - Utility classes for ioBroker adapters to support ioBroker.dm

dm-utils Utility classes for ioBroker adapters to support ioBroker.dm. How to use In your ioBroker adapter, add a subclass of DeviceManagement and ove

Samuel Weibel 1 Jan 2, 2022
A concise collection of classes for PHP, Python, JavaScript and Ruby to calculate great circle distance, bearing, and destination from geographic coordinates

GreatCircle A set of three functions, useful in geographical calculations of different sorts. Available for PHP, Python, Javascript and Ruby. Live dem

null 72 Sep 30, 2022
Qwerty is the first social website focused on connecting students with similar classes and gender identities

?? Qwerty ?? Qwerty is the first social website focused on connecting students with similar classes and gender identities. To get started simply input

Benson Liu 3 Oct 21, 2022
This plugin add a new utilities classes so you can use from 0% to 100%!

This plugin add new utilities classes so you can use from 0% to 100%!

Ehsan Akbarzadeh 2 Apr 3, 2022