Script.aculo.us JavaScripting
No CommentsThere used to be a time where if a client wanted some animating objects on their web site, I would just do it all with a custom hand coded JavaScript animation library. For example, I did the animation code for these slideshow pictures by hand (move your mouse over the thumbnails at the bottom). While it wasn’t really all that complicated technically, it was a little time consuming, since time based scripting is a bit of a pain with JavaScript. You can’t do a simple animation loop (ie move frame by X pixels, wait Y milliseconds, repeat), you have to transform that loop into a recursive function. And good luck if you want to do complicated animation sequences by daisy chaining events together.
Enter Script.aculo.us. If you’re a web developer guy, you’ve probably already heard of it, but I just got a chance to work with it recently. It’s basically a JavaScript animation library (among other AJAX-y things) based on the Prototype JavaScript framework, and it aims to simplify a lot of the tedious tasks associated with working with JavaScript to animate web page elements. For example, it’s got an Event.Queue object, which is awesome because that allows me to very easily queue up and daisy chain events together without any extra work. So in literally 20 lines of code, I was able to easily animate some previously static elements for a client’s web site1. In contrast, the custom JavaScript library I wrote for the above mentioned slideshow is well over 200 lines of code, and not really that reusable for other projects. Ok, that latter point is sort of my fault for not writing portable code… but in general I didn’t have to write any of the stupid stuff low-level stuff, and I could concentrate on the more important high-level stuff like how the animation should display. And for bonus points, it works on most web browsers (IE, Firefox, Safari) without any extra work.
Check out some of the neat demos that the developers have put together using Script.aculo.us. Pretty sweet
1 It’s not live yet, but once it is… I’ll post a link ![]()
No comments
Leave a comment