GithubHelp home page GithubHelp logo

miguelramosfdz / animations Goto Github PK

View Code? Open in Web Editor NEW

This project forked from savantos/animations

0.0 1.0 0.0 366 KB

A versatile CSS3 animation pack with various usages, trigger CSS3 animations as elements enter the viewport, as you hover with a mouse or by binding them via JavaScript functions.

Home Page: http://www.cloud-eight.com/github/animations/

CSS 92.53% JavaScript 7.47%

animations's Introduction

Animations v2.1

A versatile CSS3 animation pack with over 190 animations for various usages. Trigger CSS3 animations as elements enter the viewport, as you hover with a mouse or by binding them via JavaScript functions/event listeners.

Demo: http://www.cloud-eight.com/github/animations/

Usage

  • Add the class `no-js` to your `html` tag
  • Link 'animations.min.css', 'animations.min.js' and 'appear.min.js' to your document
  • Follow the guides below depending on what aspect of the plugin you wish to use

Animations

  • Add the class `animate-in` to the desired element
  • Add the attribute `data-anim-type` with an animation
  • (Optional) Add the attribute `data-anim-delay` if you wish to put a delay (in ms) on the animation

The plugin will auto detect elements in view on page load, any other elements assigned with the animate-in class will be executed as they enter the viewport upon scrolling.

<div class="animate-in" data-anim-type="bounce-in-up" data-anim-delay="200">Bounce In Up</div>

By default, animation duration time/speed is 1 second, if you wish to adjust this duration you can add the class slow-mo (2 seconds), super-slow-mo (3 seconds), ultra-slow-mo (4 seconds) or hyper-slow-mo (5 seconds).

<div class="animate-in slow-mo" data-anim-type="bounce-in-up" data-anim-delay="0">Slow Mo</div>
<div class="animate-in super-slow-mo" data-anim-type="bounce-in-up" data-anim-delay="0">Super Slow Mo</div>
<div class="animate-in ultra-slow-mo" data-anim-type="bounce-in-up" data-anim-delay="0">Ultra Slow Mo</div>
<div class="animate-in hyper-slow-mo" data-anim-type="bounce-in-up" data-anim-delay="0">Hyper Slow Mo</div>

Binding

There are 3 JavaScript functions at your disposal animate, animateOut and animateEnd.

To animate an element at any point you can use the animate function. The animate function needs 2 variables passed through it, the first being the ID/Class of the target element, the second is the type of animation. There is the optional 3rd variable to animate the element infinitely. Multiple elements can be targeted by seperating them with a comma.

<button onclick="animate('#element', 'tada');">Tada Once</button>
<button onclick="animate('#element, #tagline', 'tada', true);">Tada Continuously</button>

To animate an element out correctly you can use the animateOut function. The animateOut function needs 2 variables passed through it, the first being the ID/Class of the target element, the second is the type of animation. There is the optional 3rd variable to remove the element from the DOM completely after it has animated.

<button onclick="animateOut('#element', 'bounce-out');">Bounce Out</button>
<button onclick="animateOut('#element', 'bounce-out', true);">Bounce Out and Remove Element</button>

To stop an element animation correctly you can use the animateEnd function, for example with animations animating infinitely. The animateEnd function only needs 1 variable passed through it, the ID/Class of the target element. There is the optional 2nd variable to remove the element completely.

<button onclick="animateEnd('#element');">End</button>
<button onclick="animateEnd('#element', true);">End and Remove</button>

Hovers

You can also use the hover-* class to assign the animation to the :hover psuedo selector, adding the class infinite will continuously loop the animation while hovering.

<button class="hover-spin">Spin Once</button>
<button class="hover-spin infinite">Spin Continuously</button>

Browser Compatibility

  • IE 10+
  • Firefox 25+
  • Chrome 31+
  • Safari 7+
  • Opera 18+
  • Most mobile browsers

Flip animations currently don't work in IE or Firefox, this issue will be fixed soon.

Limitations

Animations executing on elements entering the viewport will not work if JavaScript is disabled. Animations are currently limited to devices with a viewport of 569px (wide) or higher.

Author

Joe Mottershaw, Cloud Eight
http://www.cloud-eight.com

Credits

Animate.css, Dan Eden
https://github.com/daneden/animate.css

CSS3 Animation Cheat Sheet, Justin Aguilar
http://www.justinaguilar.com/animations/

jquery.appear, bas2k
https://github.com/bas2k/jquery.appear

animations's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.