Talk:FBJS/Animation

From Facebook Developer Wiki

Jump to: navigation, search

Will there be beta for this? I would love to test! --1800314 07:14, 30 December 2007 (PST)

Same here. -intelliot

We've been using this animation library internally for about 2 months now, so a beta isn't necessary. I've got one more surprise waiting for you that's not mentioned, and once that's ready this will go out. We're still spinning up from holiday season so it'll might be another week. --10 12:14, 4 January 2008 (PST)

Ooo a surprise! Can't wait! --Zachary Allia 12:18, 5 January 2008 (PST)

Great feature, except, any text that is animated loses its ClearType settings under Windows XP and looks plain ugly next to all other ClearType rendered content. --Arda

That isn't specifically a Facebook problem - see http://mattberseth.com/blog/2007/12/ie7_cleartype_dximagetransform.html --61309727 03:58, 21 January 2008 (PST)


Where would be the right place to suggest that facebook add the single line --> case 'fontSize': to the list of accepted attributes in Animation.prototype._attr, so I can avoid overrides to use tasty title animations like:

function xTitle(txt,target,size){
   txt = txt || 'Be Free';
   txt=txt.push?txt:txt.split(' ');
   size = size||111;
   var root = xDiv('xFragBit',X.xPad);//This just creates a div with the specified className, on a global pre-append node (X.xPad)
   var segs = [];
/*For a title such as "Title", this monster creates: <div class='xFrag'>T<div class='xFragBit'>itle</div></div>
It does this for each space-seperated word, then creates Animations to fade in, expand and contract the text in a pleasing manner.*/
   for (var i = -1;++i < txt.length;
      segs.push(new Animation(
xTxt(xDiv('xFragBit',xTxt(xDiv('xFrag',root),txt[i].charAt(0).toUpperCase())),txt[i].substring(1).toLowerCase()))
      .duration(100).checkpoint().to('opacity',1).from(0)
      .to('fontSize',parseInt(size*0.7,10)).from(1)
      .to('width','auto').from(0)
      .to('paddingRight',size/5).to('paddingBottom',size/5)
      .show().duration(1500))
      );
   new Animation(root).to('opacity',1).from('opacity',0)
      .to('width','auto').from(0)
      .to('fontSize',size*1.7).from(1).to('color','#7fafff').show().ease(Animation.ease.end).duration(2000).checkpoint(1,function(){
         for (var i = segs.length;i -- > 0;segs[i].go());
      })
      .to('fontSize',size).to('color','#eff8ff').ease(Animation.ease.both).duration(1500).go();for (var i = segs.length;i -- > 0;segs[i].go());
   return target.appendChild(root)
}

function xDiv(type,parent){
   var ret = parent.appendChild(document.createElement('div'));
   ret.className = type;
   return ret;
}
function xTxt(el,txt){
return el.appendChild(document.createTextNode(txt)).parentNode;
}

[edit] This is a worse version of JQuery

this is a pretty basic library compared to the power and speed of JQuery. Also, I was checking out the FB Connect JS API. While insanely powerful and pushes JS to the limits, 99% of the variables/methods live in a global scope. Doesn't make much sense.

JQuery is rubbish. It may have much more animations but it's not as tidy and compant. Even though FB Animation is simple it's effective.

[edit] Needs More Documentation

Anything else but onclick, anyone? Please explain/link to syntax

reference