A Nice Find, Animator.js

It's Like script.aculo.us and moo.fx, but Half the Calories

Right before I left on my vacation I came across a very nice JavaScript Animation class called Animator.js. In the past, I've switched between using script.aculo.us and moo.fx for various projects, but at times it seemed I would run into problems. Their frameworks sometimes interfere with the latest version of prototype.js, or they were overkill for whatever task I was trying to perform. I think that's why I kind of like Animator.js. It's a self contained class that allows you to perform various animation task. It's lightweight and extremely easy to implement.

I recommend checking out the authors site [BernieCode] to find out more and also, I've created a little demo (edit: deactive) that duplicates one of WebKit's new CSS animations. Check it out and let me know what you think.

Note: It wasn't really explained on Bernie's website, but you need to return window[Animator][Control Function] after you call new Animator() to get the animation to work.

function AnimatorTest() {
   ani = new Animator({duration: 1500})
      .addSubject(new NumericalStyleSubject($('CB'), 'opacity', 0, 1));
   return window['ani']['play'](); // return the ani window variable and intiate "play"
}
window.addEventListener?window.addEventListener("load", AnimatorTest,false):window.attachEvent("onload", AnimatorTest);

1 responses to "A Nice Find, Animator.js"

martin
martin says:
could you please explain "but you need to return window[Animator][Control Function] after you call new Animator() to get the animation to work." ?
Doug
Doug responds:
@martin - Yeah, I was kind of cryptic on that. I've updated the post by showing an example.

Have something to say? Leave a comment!

You don't have to be registered to leave a comment. Unregistered user's comments will be approved before going live.




You are currently posting as an unregistered user.
This means that your comment will be reviewed prior to going live. If you are a registered user, please . New user? No problem, register for an account, it's FREE! Benefits include, posting instantly, screen name protection, collaboration recognition, subscribe to article updates, and so much more!