Git Product home page Git Product logo

animations's Introduction

Animations

Easily add a set of predefined CSS3 animations to elements to execute as they enter the viewport or to trigger via JavaScript or mouse hover. If you do end up using it on your site, let me know so I can see how people are implementing and using it :)

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

Usage

  • Add the class `no-js` to your `html` tag
  • Link both animations.css and animations.js to your document

Animations

The bulk of the plugin will auto detect elements in view on page load, any other element assigned with the animate class and a data-anim-type attribute will be executed as it enters the viewport.

  • Add the class `animate` to the desired element
  • Add the attribute `data-anim-type` with an animation type
  • (Optional) Add the attribute `data-anim-delay` if you wish to put a delay (in ms) on the animation
<span class="animate" data-anim-type="bounceIn" data-anim-delay="200">Bouncy Bouncy</span>
Animation Class Name
Fade In fadeIn
Fade In Up fadeInUp
Fade In Down fadeInDown
Fade In Left fadeInLeft
Fade In Right fadeInRight
Fade Out fadeOut
Fade Out Up fadeOutUp
Fade Out Down fadeOutDown
Fade Out Left fadeOutLeft
Fade Out Right fadeOutRight
Zoom In zoomIn
Zoom In Up zoomInUp
Zoom In Down zoomInDown
Zoom In Left zoomInLeft
Zoom In Right zoomInright
Zoom Out zoomOut
Zoom Out Up zoomOutUp
Zoom Out Down zoomOutDown
Zoom Out Left zoomOutLeft
Zoom Out Right zoomOutRight
Bounce In bounceIn
Bounce In Up bounceInUp
Bounce In Down bounceInDown
Bounce In Left bounceInLeft
Bounce In Right bounceInRight
Bounce Out bounceOut
Bounce Out Up bounceOutUp
Bounce Out Down bounceOutDown
Bounce Out Left bounceOutLeft
Bounce Out Right bounceOutRight
Spin Left spinRight
Spin Right spinLeft

Triggers and Hovers

There are 2 types of predefined trigger functions, 1 that executes the animation once and another which loops continuously. You can pass 2 variables into these functions and that is the ID/Class of the target element and what type of animation you want to execute. Multiple elements can be targeted by seperating them with a comma.

<button onclick="triggerOnce('#logo', 'wave');">Wave Once</button>
<button onclick="triggerInfinite('#logo, #tagline', 'wave');">Wave Continuously</button>

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

<button class="onHoverSpin">Spin Once</button>
<button class="onHoverSpin infinite">Spin Continuously</button>
Animation Triggers Hovers Class Name
Flash Yes Yes flash
Strobe Yes Yes strobe
Shake Yes Yes shake
Bounce Yes Yes bounce
Tada Yes Yes tada
Wave Yes Yes wave
Spin Yes Yes spin
Pullback Yes Yes pullback
Wobble Yes Yes wobble
Pulse Yes Yes pulse
Pulsate Yes Yes pulsate
Heartbeat Yes Yes heartbeat
Panic Yes Yes panic
Explode Yes No explode
Random Yes No random

Limitations

Since this uses Digital Fusions' visible plugin, the same limitations apply to this also, in that it will not check for visibility in nested scrollable areas, only on the main viewport (window object). Animations executing on elements entering the viewport will not work if JavaScript is disabled, it will just display the element normally. Animations are currently limited to desktops with a screensize of 960px and higher, however Triggers and Hovers will work on the majority of touch devices.

Author

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

Credits

Visible.js, TeamDF, Digital Fusion
http://www.teamdf.com

animations's People

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.