moo.fx 2.0 released with Fx.Style while Animator.js avoids inheritance

| by Rob Thornton on Nov 07, 2006. Estimated reading time: 1 minute |

moo.fx 2.0 has been released featuring new effects to modify any CSS property, the color properties of elements, and to internally scroll long divs. An interesting alternative not using inheritance but providing similar functionality is the Animator.js library.  moo.fx and Animator.js are both JavaScript effects frameworks designed for speed, robustness, and small size.  moo.fx provides a number of demos on their mootools wiki. moo.fx is available as part of mootools or separately for use with prototype. This new release incorporates significant architectural changes to moo.fx and existing scripts are not guaranteed to work with it. moo.fx is described as:

moo.fx is a superlightweight, ultratiny, megasmall javascript effects library, to be used with prototype.js or the mootools framework.

It's very easy to use, blazing fast, cross-browser, standards compliant, provides controls to modify any CSS property of any HTML element, including colors, with builtin checks that won't let a user break the effect with multiple, crazy clicks. Optimized to make you write the lesser code possible, the new moo.fx is so modular you can create any kind of effect with it.

Bernie Sumption introduces Animator as an easy-to-use animation class with a small file size that uses composition and parameterization instead of inheritance. It was written as an alternative to moo.fx and because Sumption felt strongly about the decision to use inheritance:

In particular, they don't seem to realise that inheritance is evil, and must be destroyed. By providing base classes for an effect and requiring users to subclass it to make new effects, they create a proliferation of classes and make it too hard to create new effects that the library designer hasn't thought of (scriptaculous gets round this by thinking of every effect you might want, which is why it is so large).

In a comment on Ajaxian he mentions that he doesn't consider inheritance to be always evil, just overused in JavaScript. Currently Animator.js depends upon prototype, but he is considering lifting that restriction.

Rate this Article


Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Hi InfoQ readers by Bernard Sumption

This seems like a good time and place to mention that I'm preparing an update to Animator.js that will indeed, as Rob mentioned, remove the dependency on Prototype.

Another much wished-for feature is the ability to set the to and from states of an animation using CSS class names so that you can keep all of your style information in one place.

If any of you have any other things you'd like to see developed, let me know on this page.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

1 Discuss