Friday, November 3rd, 2006p>Bernie Sumption loves the functionality of Moo.fx, Script.aculo.us and Rico but thinks that inheritance is evil:
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).
So, he decided to use the strategy design for his new animation library Animator.js (also built on Prototype).
What sets it apart from other animation libraries is the that you can use CSS to define the start and end states:
- var fade = Animator.apply($('myID'), "background-color: #FFFF00; width: 100px; height: 100px;");
- // or
- var ex11 = new Animator().addSubject(new CSSStyleSubject(
- "width: 10em; background-color: rgb(256, 256, 256); border-width: 1px;",
- "width: 40em; background-color: #F39; border-width: 5px;"));
Simple. Small. Fast.
Check out his tutorial to see it all in action
Posted by Dion Almaer at 7:39 am