You are on page 1of 10

Animate.

css
Animación CSS de solo-agregar-agua

animate.csses un conjunto de animaciones geniales, divertidas y entre navegadores


para que las use en sus proyectos. Ideal para enfatizar, páginas de inicio, controles
deslizantes, y general-simplemente-agregar-agua-genialidad.

Instalación
Para instalar a través de Bower, simplemente haga lo siguiente:

$ bower install animate.css --save

o puede instalar a través de npm:

$ npm instalar animate.css --save

Uso Básico

1. Incluya la hoja de estilo en su documento <head>

< head >


< link rel = " stylesheet " href = " animate.min.css " >
</ head >

En lugar de instalar, puede usar la versión remota (alojada por CDNJS ):

< head >


< link rel = " stylesheet "
href = " https://cdn.jsdelivr.net/npm/animate.css@3.5.2/animate.min.css " >
<! - o ->
< link rel = " hoja de estilos "
href = "
https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.5.2/animate.min.css " >
</ head >

Puede generar un hash SRI de esa versión en particular y luego usarlo para
asegurar la integridad del archivo; también puede realizar solicitudes anónimas a
CDN configurando el crossoriginatributo correspondiente :
< head >
< link rel = " stylesheet "
href = " https://cdn.jsdelivr.net/npm/animate.css@3.5.2/animate.min.css "
integrity = " sha384-OHBBOqpYHNsIqQy8hL1U + 8OXf9hH6QRxi0 +
EODezv82DfnZoV7qoHAZDwMwEJvSw "
crossorigin = " anonymous " >
<! - or ->
< link rel = " stylesheet "
href = "
https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.5.2/animate.min.css "
integridad =" sha384-OHBBOqpYHNsIqQy8hL1U + 8OXf9hH6QRxi0 +
EODezv82DfnZoV7qoHAZDwMwEJvSw "
crossorigin = " anonymous " >
</ head >

2. Agregue la clase animatedal elemento que desea animar. Es posible que


también desee incluir la clase infinitepara un ciclo infinito.

3. Finalmente, necesita agregar una de las siguientes clases:

Nombre de la clase

bounce flash pulse rubb

shake headShake swing tada

wobble jello bounceIn boun

bounceInLeft bounceInRight bounceInUp boun

bounceOutDown bounceOutLeft bounceOutRight boun

fadeIn fadeInDown fadeInDownBig fade

fadeInLeftBig fadeInRight fadeInRightBig fade

fadeInUpBig fadeOut fadeOutDown fade

fadeOutLeft fadeOutLeftBig fadeOutRight fade

fadeOutUp fadeOutUpBig flipInX flip

flipOutX flipOutY lightSpeedIn ligh

rotateIn rotateInDownLeft rotateInDownRight rota

rotateInUpRight rotateOut rotateOutDownLeft rota

rotateOutUpLeft rotateOutUpRight hinge jack

rollIn rollOut zoomIn zoom

zoomInLeft zoomInRight zoomInUp zoom

zoomOutDown zoomOutLeft zoomOutRight zoom

slideInDown slideInLeft slideInRight slid

slideOutDown slideOutLeft slideOutRight slid

Ejemplo completo:
< h1 class = " bounce infinito animado " > Ejemplo </ h1 >

¡Mira todas las animaciones aquí!

Uso
Para usar animate.css en su sitio web, simplemente coloque la hoja de estilos en su
documento <head>y agregue la clase animateda un elemento junto con cualquiera
de los nombres de la animación. ¡Eso es! Tienes un elemento animado CSS. ¡Súper!
< head >
< link rel = " stylesheet " href = " animate.min.css " >
</ head >

o use la versión alojada por CDNJS

< head >


< link rel = " stylesheet " href = "
https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.5.2/animate.min.css " >
</ head >

Puede hacer un montón de otras cosas con animate.css cuando lo combina con
jQuery o agrega sus propias reglas de CSS. Agregue dinámicamente animaciones
usando jQuery con facilidad:

$ ( ' # tuElemento ' ). addClass ( ' bounceOutLeft animado ' );

También puedes detectar cuándo termina una animación:

// Ver https://github.com/daneden/animate.css/issues/644
var animationEnd = ( function ( el ) {
var animations = {
animación : ' animationend ' ,
OAnimation : ' oAnimation End ' ,
MozAnimation : ' mozAnimationEnd ' ,
WebkitAnimation : ' webkitAnimationEnd ' ,
};

for ( var t en animaciones) {


if ( el . style [t] ! == undefined ) {
return animations [t];
}
}
}) ( document . createElement ( ' div ' ));

$ ( ' # tuElemento ' ). uno (animationEnd, doSomething);

Vea un video tutorial sobre cómo usar Animate.css con jQuery aquí.

Nota: jQuery.one() se usa cuando desea ejecutar el controlador de eventos a lo


sumo una vez . Más información aquí .
También puede extender jQuery para agregar una función que lo haga todo por
usted:

$ . fn . extend ({
animateCss : function ( animationName , callback ) {
var animationEnd = ( function ( el ) {
var animations = {
animación : ' animationend ' ,
OAnimation : ' oAnimation End ' ,
MozAnimation : ' mozAnimationEnd ' ,
WebkitAnimation : ' webkitAnimationEnd ' ,
};

for ( var t en animaciones) {


if ( el . style [t] ! == undefined ) {
return animations [t];
}
}
}) ( document . createElement ( ' div ' ));

esta . addClass ( ' animated ' + animationName). uno (animationEnd,


function () {
$ ( this ). removeClass ( ' animated ' + animationName);

if ( typeof callback === ' function ' ) callback ();


});

devuelve esto ;
},
});

Y úsalo así:

$ ( ' # tuElemento ' ). animateCss ( ' rebote ' );


o;
$ ( ' # tuElemento ' ). animateCss ( ' bounce ' , function () {
// Hacer algo después de la animación
});

Puede cambiar la duración de sus animaciones, agregar un retraso o cambiar el


número de veces que se reproduce:

# tuElemento {
-vendor-animación-duración : 3 s ;
-vendor-animation-delay : 2 s ;
-vendor-animation-iteration-count : infinito ;
}

Nota: asegúrese de reemplazar "proveedor" en el CSS con los prefijos de proveedor


aplicables (webkit, moz, etc.)
Compilaciones personalizadas
Animate.css funciona con gulp.js , y puedes crear compilaciones personalizadas con
bastante facilidad. Antes que nada, necesitarás Gulp y todas las demás
dependencias:

$ cd path / to / animate.css /
$ sudo npm install

A continuación, ejecute gulppara compilar sus compilaciones personalizadas. Por


ejemplo, si solo desea algunos de los "buscadores de atención", simplemente edite
el animate-config.jsonarchivo para seleccionar solo las animaciones que desea usar.
" attention_seekers " : {
" bounce " : true ,
" flash " : falso ,
" pulse " : falso ,
" shake " : true ,
" headShake " : true ,
" swing " : true ,
" tada " : true ,
" wobble " : cierto ,
" jello " : true
}

Licencia
Animate.css está autorizado bajo la licencia de
MIT. ( http://opensource.org/licenses/MIT )

Contribuyendo
Las solicitudes de extracción son el camino a seguir aquí. Me disculpo de antemano
por la lentitud de las solicitudes y problemas de extracción. Solo tengo dos reglas
para enviar una solicitud de extracción: coincida con la convención de
nomenclatura (camelCase, categorizado [fades, rebotes, etc.]) y veamos una
demostración de las animaciones enviadas en un bolígrafo . Ese último es
importante.

Just-add-water CSS animation


animate.css is a bunch of cool, fun, and cross-browser animations for you to use in
your projects. Great for emphasis, home pages, sliders, and general just-add-water-
awesomeness.

Installation
To install via Bower, simply do the following:

$ bower install animate.css --save

or you can install via npm:

$ npm install animate.css --save

Basic Usage

1. Include the stylesheet on your document's <head>

<head>
<link rel="stylesheet" href="animate.min.css">
</head>

Instead of installing you may use the remote version (hosted by CDNJS):

<head>
<link rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/animate.css@3.5.2/animate.min.css">
<!-- or -->
<link rel="stylesheet"

href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.5.2/animate.min.css">
</head>

You may generate a SRI hash of that particular version and then use it to ensure
the file's integrity; also you can make anonymous requests to CDN by setting the
corresponding crossorigin attribute:
<head>
<link rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/animate.css@3.5.2/animate.min.css"
integrity="sha384-
OHBBOqpYHNsIqQy8hL1U+8OXf9hH6QRxi0+EODezv82DfnZoV7qoHAZDwMwEJvSw"
crossorigin="anonymous">
<!-- or -->
<link rel="stylesheet"

href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.5.2/animate.min.css"
integrity="sha384-
OHBBOqpYHNsIqQy8hL1U+8OXf9hH6QRxi0+EODezv82DfnZoV7qoHAZDwMwEJvSw"
crossorigin="anonymous">
</head>

2. Add the class animated to the element you want to animate. You may also
want to include the class infinite for an infinite loop.

3. Finally you need to add one of the following classes:

Class Name

bounce flash pulse rubber

shake headShake swing tada

wobble jello bounceIn bounce

bounceInLeft bounceInRight bounceInUp bounce

bounceOutDown bounceOutLeft bounceOutRight bounce

fadeIn fadeInDown fadeInDownBig fadeIn

fadeInLeftBig fadeInRight fadeInRightBig fadeIn

fadeInUpBig fadeOut fadeOutDown fadeOu

fadeOutLeft fadeOutLeftBig fadeOutRight fadeOu

fadeOutUp fadeOutUpBig flipInX flipIn

flipOutX flipOutY lightSpeedIn lightS

rotateIn rotateInDownLeft rotateInDownRight rotate

rotateInUpRight rotateOut rotateOutDownLeft rotate

rotateOutUpLeft rotateOutUpRight hinge jackIn

rollIn rollOut zoomIn zoomIn

zoomInLeft zoomInRight zoomInUp zoomOu

zoomOutDown zoomOutLeft zoomOutRight zoomOu

slideInDown slideInLeft slideInRight slideI

slideOutDown slideOutLeft slideOutRight slideO

Full example:

<h1 class="animated infinite bounce">Example</h1>

Check out all the animations here!


Usage
To use animate.css in your website, simply drop the stylesheet into your
document's <head>, and add the class animated to an element, along with any of the
animation names. That's it! You've got a CSS animated element. Super!
<head>
<link rel="stylesheet" href="animate.min.css">
</head>

or use the version hosted by CDNJS

<head>
<link rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.5.2/animate.min.css">
</head>

You can do a whole bunch of other stuff with animate.css when you combine it
with jQuery or add your own CSS rules. Dynamically add animations using jQuery
with ease:

$('#yourElement').addClass('animated bounceOutLeft');

You can also detect when an animation ends:

// See https://github.com/daneden/animate.css/issues/644
var animationEnd = (function(el) {
var animations = {
animation: 'animationend',
OAnimation: 'oAnimationEnd',
MozAnimation: 'mozAnimationEnd',
WebkitAnimation: 'webkitAnimationEnd',
};

for (var t in animations) {


if (el.style[t] !== undefined) {
return animations[t];
}
}
})(document.createElement('div'));

$('#yourElement').one(animationEnd, doSomething);

View a video tutorial on how to use Animate.css with jQuery here.

Note: jQuery.one() is used when you want to execute the event handler at
most once. More information here.
You can also extend jQuery to add a function that does it all for you:

$.fn.extend({
animateCss: function(animationName, callback) {
var animationEnd = (function(el) {
var animations = {
animation: 'animationend',
OAnimation: 'oAnimationEnd',
MozAnimation: 'mozAnimationEnd',
WebkitAnimation: 'webkitAnimationEnd',
};

for (var t in animations) {


if (el.style[t] !== undefined) {
return animations[t];
}
}
})(document.createElement('div'));

this.addClass('animated ' + animationName).one(animationEnd, function() {


$(this).removeClass('animated ' + animationName);

if (typeof callback === 'function') callback();


});

return this;
},
});

And use it like this:

$('#yourElement').animateCss('bounce');
or;
$('#yourElement').animateCss('bounce', function() {
// Do somthing after animation
});

You can change the duration of your animations, add a delay or change the
number of times that it plays:

#yourElement {
-vendor-animation-duration: 3s;
-vendor-animation-delay: 2s;
-vendor-animation-iteration-count: infinite;
}

Note: be sure to replace "vendor" in the CSS with the applicable vendor prefixes
(webkit, moz, etc)

Custom Builds
Animate.css is powered by gulp.js, and you can create custom builds pretty easily.
First of all, you’ll need Gulp and all other dependencies:

$ cd path/to/animate.css/
$ sudo npm install

Next, run gulp to compile your custom builds. For example, if you want only some
of the “attention seekers”, simply edit the animate-config.json file to select only the
animations you want to use.
"attention_seekers": {
"bounce": true,
"flash": false,
"pulse": false,
"shake": true,
"headShake": true,
"swing": true,
"tada": true,
"wobble": true,
"jello":true
}

License
Animate.css is licensed under the MIT license. (http://opensource.org/licenses/MIT)

Contributing
Pull requests are the way to go here. I apologise in advance for the slow action on
pull requests and issues. I only have two rules for submitting a pull request: match
the naming convention (camelCase, categorised [fades, bounces, etc]) and let us
see a demo of submitted animations in a pen. That last one is important.

You might also like