Simply Program

Simply programming - It’s a life style
Filed under Programming, Javascript

We have a function - resizeAll()

Now, what does this function do?

Quite simple, if you read in my earlier post about the issue I found with YUI's animation class you would know what the purpose of this function does.

If you know NOTHING about what I speak, read my post here:
http://simplyprogram.com/yui-interesting-find/

Back to the function -- My initial test was to take one or many images and have them animate the EXACT SAME as the containing element. I am proud to say this has been accomplished!

So when we started this our code looked a little bit like this:

JavaScript:
  1. var attributes = {
  2. width: { to: 0 },
  3. height: { to: 0 },
  4. opacity: { to: 1 },
  5. fontSize: { from: 100, to: 0, unit: '%'}
  6. };
  7.  
  8. var anim = new YAHOO.util.Anim(itemObj,
  9. attributes, 1.0, YAHOO.util.Easing.backOut);
  10.  
  11. anim.animate();

With my new function in place our code looks like this:

JavaScript:
  1. var attributes = {
  2. width: { to: 0 },
  3. height: { to: 0 },
  4. opacity: { to: 1 },
  5. fontSize: { from: 100, to: 0, unit: '%'}
  6. };
  7.  
  8. var anim = new YAHOO.util.Anim(itemObj,
  9. attributes, 1.0,YAHOO.util.Easing.backOut);
  10.  
  11. anim.resizeAll();
  12. anim.animate();

Thats it - Simply place anim.resizeAll() within your code and ALL images will take on the same attributes and animation method as your containing element.

What is next for this function?

I am now working to make it pretty much any element you could possibly want to animate!

On the priority list:
1. Other Divs
2. Other font tags
3. OBJECT Codes (Includes Flash :D )
4. Forms
I think that should do it for now. :)

Until my next update!

Posted by sp on Wednesday, May 16th, 2007


You can follow any responses to this entry through the magic of "RSS 2.0" and leave a trackback from your own site.