Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Amazing UI with CSS and Anima.js

fwdays
March 05, 2013

Amazing UI with CSS and Anima.js

fwdays

March 05, 2013
Tweet

More Decks by fwdays

Other Decks in Programming

Transcript

  1. CSS, Bad parts •  Not easy to stop animation once

    started •  You have to deal with percent •  Limited user control
  2. Stats •  25kB (4kB minified and gziped) •  4 weeks

    of development •  2 week after public release •  ≈600 stargazers
  3. API

  4. API var  world  =  anima.js();   var  world  =  anima.css();

      var  item  =  world.add(   document    .querySelector("div")   );   item.animate(...).css();  
  5. .animate() item.animate({      translate:  [x,  y,  z],    

     duration:  500,      ease:  'ease-­‐in-­‐out-­‐quad',      delay:  100   })  
  6. Parallel animations item.animate(  [   {      translate:  [x,

     y,  z],      duration:  500   },  ...   ]  )  
  7. Matrix matrix3d(    1,  0,  0,  0,      0,

     1,  0,  0,        0,  0,  1,  0,        0,  0,  0,  1   )  
  8. Scale & Translate matrix3d(      sX,    0,  

     0,  0,        0,  sY,    0,  0,        0,    0,  sZ,  0,      tX,  tY,  tZ,  1   )  
  9. Rotate matrix3d(      cos(Y)cos(Z),      cos(X)cos(Z)    

     +sin(X)sin(Y)cos(Z),      sin(X)sin(Z)      -­‐cos(X)sin(Y)cos(Z),  0,      ...   )