Animate.
css
Animación CSS de solo-agregar-agua
[Link] 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 [Link] --save
o puede instalar a través de npm:
$ npm instalar [Link] --save
Uso Básico
1. Incluya la hoja de estilo en su documento <head>
< head >
< link rel = " stylesheet " href = " [Link] " >
</ head >
En lugar de instalar, puede usar la versión remota (alojada por CDNJS ):
< head >
< link rel = " stylesheet "
href = " [Link] " >
<! - o ->
< link rel = " hoja de estilos "
href = "
[Link] " >
</ 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 = " [Link] "
integrity = " sha384-OHBBOqpYHNsIqQy8hL1U + 8OXf9hH6QRxi0 +
EODezv82DfnZoV7qoHAZDwMwEJvSw "
crossorigin = " anonymous " >
<! - or ->
< link rel = " stylesheet "
href = "
[Link] "
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 [Link] 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 = " [Link] " >
</ head >
o use la versión alojada por CDNJS
< head >
< link rel = " stylesheet " href = "
[Link] " >
</ head >
Puede hacer un montón de otras cosas con [Link] 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 [Link]
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 [Link] con jQuery aquí.
Nota: [Link]() 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
[Link] funciona con [Link] , y puedes crear compilaciones personalizadas con
bastante facilidad. Antes que nada, necesitarás Gulp y todas las demás
dependencias:
$ cd path / to / [Link] /
$ 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 [Link] 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
[Link] está autorizado bajo la licencia de
MIT. ( [Link] )
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
[Link] 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 [Link] --save
or you can install via npm:
$ npm install [Link] --save
Basic Usage
1. Include the stylesheet on your document's <head>
<head>
<link rel="stylesheet" href="[Link]">
</head>
Instead of installing you may use the remote version (hosted by CDNJS):
<head>
<link rel="stylesheet"
href="[Link]
<!-- or -->
<link rel="stylesheet"
href="[Link]
</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="[Link]
integrity="sha384-
OHBBOqpYHNsIqQy8hL1U+8OXf9hH6QRxi0+EODezv82DfnZoV7qoHAZDwMwEJvSw"
crossorigin="anonymous">
<!-- or -->
<link rel="stylesheet"
href="[Link]
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 [Link] 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="[Link]">
</head>
or use the version hosted by CDNJS
<head>
<link rel="stylesheet"
href="[Link]
</head>
You can do a whole bunch of other stuff with [Link] 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 [Link]
var animationEnd = (function(el) {
var animations = {
animation: 'animationend',
OAnimation: 'oAnimationEnd',
MozAnimation: 'mozAnimationEnd',
WebkitAnimation: 'webkitAnimationEnd',
};
for (var t in animations) {
if ([Link][t] !== undefined) {
return animations[t];
}
}
})([Link]('div'));
$('#yourElement').one(animationEnd, doSomething);
View a video tutorial on how to use [Link] with jQuery here.
Note: [Link]() 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:
$.[Link]({
animateCss: function(animationName, callback) {
var animationEnd = (function(el) {
var animations = {
animation: 'animationend',
OAnimation: 'oAnimationEnd',
MozAnimation: 'mozAnimationEnd',
WebkitAnimation: 'webkitAnimationEnd',
};
for (var t in animations) {
if ([Link][t] !== undefined) {
return animations[t];
}
}
})([Link]('div'));
[Link]('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
[Link] is powered by [Link], and you can create custom builds pretty easily.
First of all, you’ll need Gulp and all other dependencies:
$ cd path/to/[Link]/
$ 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 [Link] 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
[Link] is licensed under the MIT license. ([Link]
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.