Angular Bootstrap Animations
Angular Animations - Bootstrap 4 & Material Design
Note: This documentation is for an older version of Bootstrap (v.4). A
newer version is available for Bootstrap 5. We recommend migrating to the latest version of our product - Material Design for
Bootstrap 5.
Go to docs v.5
Angular Bootstrap animations are illusions of motions for web elements. +70 animations generated by CSS only, work properly on every browser.
Required external library
Starting with MDB Angular 8, using the following basic animations requires installing and importing an additional library - Animate.css. Install this library from the npmjs repository, and import the
animate.css
file in theangular.json
file.
npm install animate.css@3.7.2 --save
"styles": [
"node_modules/angular-bootstrap-md/scss/bootstrap/bootstrap.scss",
"node_modules/angular-bootstrap-md/assets/scss/mdb.scss",
"node_modules/animate.css/animate.css",
"src/styles.scss"
],
Basic usage
Using our animation is simple.
Step 1: Add the class .animated
to the element you want to animate.
Step 2: Add one of the following classes:
.bounce
.flash
.pulse
.rubberBand
.shake
.headShake
.swing
.tada
.wobble
.jello
.bounceIn
.bounceInDown
.bounceInLeft
.bounceInRight
.bounceInUp
.bounceOut
.bounceOutDown
.bounceOutLeft
.bounceOutRight
.bounceOutUp
.fadeIn
.fadeInDown
.fadeInDownBig
.fadeInLeft
.fadeInLeftBig
.fadeInRight
.fadeInRightBig
.fadeInUp
.fadeInUpBig
.fadeOut
.fadeOutDown
.fadeOutDownBig
.fadeOutLeft
.fadeOutLeftBig
.fadeOutRight
.fadeOutRightBig
.fadeOutUp
.fadeOutUpBig
.flipInX
.flipInY
.flipOutX
.flipOutY
.lightSpeedIn
.lightSpeedOut
.rotateIn
.rotateInDownLeft
.rotateInDownRight
.rotateInUpLeft
.rotateInUpRight
.rotateOut
.rotateOutDownLeft
.rotateOutDownRight
.rotateOutUpLeft
.rotateOutUpRight
.hinge
.rollIn
.rollOut
.zoomIn
.zoomInDown
.zoomInLeft
.zoomInRight
.zoomInUp
.zoomOut
.zoomOutDown
.zoomOutLeft
.zoomOutRight
.zoomOutUp
.slideInDown
.slideInLeft
.slideInRight
.slideInUp
.slideOutDown
.slideOutLeft
.slideOutRight
.slideOutUp
Step 3 (additionally): You may also want to include the class infinite for an infinite loop.
<img class="animated bounce infinite" src="https://mdbootstrap.com/img/logo/mdb-transparent.webp">
Reveal Animations When Scrolling
Thanks to MDB you can easily launch an animation on page scroll.
Basic usage
Step 1: Initialize script for animations on a scroll in your index.html .
Step 2: Add the CSS class .wow to a HTML element: it will be invisible until the user scrolls to reveal it.
Step 3: Pick an animation style from the list of animations , then add the CSS class to the HTML element.
Installation
In order to use WOW Animations, add below lines to index.html
file before ending
</body>
tag.
<script src="https://cdnjs.cloudflare.com/ajax/libs/wow/1.1.2/wow.min.js"></script>
<script>
new WOW().init();
</script>
Options
Use one of the custom attributes below to change the behavior of the animations on a scroll.
-
data-wow-duration
: Change the animation duration -
data-wow-delay
: Delay before the animation starts -
data-wow-offset
: Distance to start the animation (related to the browser bottom) -
data-wow-iteration
: Number of times the animation will be repeated
<img src="..." class="wow fadeInUp" data-wow-delay="0.6s">
Customize Settings
-
boxClass
: Class name that reveals the hidden box when user scrolls -
animateClass
: Class name that triggers the CSS animations -
offset
: Define the distance between the bottom of browser viewport and the top of the hidden box. When the user scrolls and reaches this distance, the hidden box is revealed. -
mobile
: Turn on/off animations on mobile devices. -
live
: constantly check for new animated elements on the page
wow = new WOW({
boxClass: 'wow', // default
animateClass: 'animated', // default
offset: 0, // default
mobile: true, // default
live: true // default
})
wow.init();