Para poder utilizarla, lo primero que debemos de hacer es añadirla al proyecto como cualquier otra librería que podamos utilizar.
<script type="text/javascript" src="path/to/jsAnim.js"></script>
Una vez que tenemos añadida la librería a nuestro proyecto, debemos de crear una instancia del objeto jsAnimManager, que será el encargado de gestionar las animaciones de varios objetos.
var manager = new jsAnimManager(40);
El valor que le pasamos por parámetro es el tiempo en milisegundos entre un frame y otro. Al pasarle el valor de 40, le estamos indicando que cada 40 milisegundos renderice el frame. El valor por defecto es de 40.
Casi todos los elementos de una página pueden ser animados, pero para conseguir esto, primero debemos de crear un objeto jsAnimObject.
var anim = manager.createAnimObject("elementId");
El elemento ID que le pasamos es el identificador del objeto que queremos animar. Múltiples managers pueden ser creados para un mismo elemento y animar mas de uno de sus atributos al mismo tiempo. La sintaxis para animar una propiedad es simple.
anim.add({property: Prop.top, from: 50, to: 500, duration: 2000});
Este comando empezará con el objeto con un valor top de 50 y gradualmente cambiarlo hasta 500, la transición durará 2 segundos.
Con esto ya tendríamos creado el código JavaScript para crear la animación. Solo nos faltaría crear el código HTML y CSS del elemento que queremos animar.
El código HTML es tan sencillo como crear un elemento y asignarle el id que le hemos indicado al crear el objeto createAnimObject (si es una imagen, entonces esta se moverá hacia arriba), y los estilos son los que nosotros queramos darle.
Entre las numerosas propiedades que se puenden modificar son:
//Delay the animation, only a duration parameter is needed Prop.wait //Position properties expect to and from values of the form //new Pos(x, y) //Position, following a line-based path Prop.position /*! Follows a semicircular path Params: -clockwise : True for clockwise, false otherwise */ Prop.positionSemicircle(clockwise) /*! Follows a circular path through target then back to start Params: -clockwise : True for clockwise, false otherwise */ Prop.positionCircle(clockwise) //Position and margin properties should not be animated if //position is registered Prop.top Prop.right Prop.bottom Prop.left Prop.margin Prop.marginTop Prop.marginRight Prop.marginBottom Prop.marginLeft Prop.padding Prop.paddingTop Prop.paddingRight Prop.paddingBottom Prop.paddingLeft //Border width properties require a from parameter Prop.borderWidth Prop.borderTopWidth Prop.borderRightWidth Prop.borderBottomWidth Prop.borderLeftWidth Prop.fontSize //Height, width, and dimension attempt to preserve center //if position is registered Prop.height Prop.width //Dimension to and from values should be of the form //new Dim(height, width) Prop.dimension //Colour to and from values should be of the form //new Col(red, green, blue) where parameters are a number //between 0 and 255 inclusive Prop.color Prop.backgroundColor Prop.borderColor //Opacity is between 0 and 1 Prop.opacity
Pueden Ver más información en su web oficial






