2 moo.fx, simple effects library built with prototype.js (http://prototype.conio.net).
3 by Valerio Proietti (http://mad4milk.net) MIT-style LICENSE.
4 for more info (http://moofx.mad4milk.net).
10 var fx = new Object();
11 fx.Base = function(){};
13 setOptions: function(options) {
18 Object.extend(this.options, options || {});
22 this.duration = this.options.duration;
23 this.startTime = (new Date).getTime();
24 this.timer = setInterval (this.step.bind(this), 13);
28 var time = (new Date).getTime();
29 var Tpos = (time - this.startTime) / (this.duration);
30 if (time >= this.duration+this.startTime) {
32 clearInterval (this.timer);
34 if (this.options.onComplete) setTimeout(this.options.onComplete.bind(this), 10);
37 this.now = ((-Math.cos(Tpos*Math.PI)/2) + 0.5) * (this.to-this.from) + this.from;
38 //this time-position, sinoidal transition thing is from script.aculo.us
43 custom: function(from, to) {
44 if (this.timer != null) return;
55 clearTimer: function() {
56 clearInterval(this.timer);
62 fx.Layout = Class.create();
63 fx.Layout.prototype = Object.extend(new fx.Base(), {
64 initialize: function(el, options) {
66 this.el.style.overflow = "hidden";
67 this.el.iniWidth = this.el.offsetWidth;
68 this.el.iniHeight = this.el.offsetHeight;
69 this.setOptions(options);
73 fx.Height = Class.create();
74 Object.extend(Object.extend(fx.Height.prototype, fx.Layout.prototype), {
75 increase: function() {
76 this.el.style.height = this.now + "px";
80 if (this.el.offsetHeight > 0) this.custom(this.el.offsetHeight, 0);
81 else this.custom(0, this.el.scrollHeight);