Core Effects > Effect.Tween

This effect tweens between two values and sets a property or calls a method on an object (including DOM elements); or allows for a callback method, which will be automatically bound to the object.


script.aculo.us V1.8 and later.


 new Effect.Tween(element, startVal, endVal, [options], propertyName);
 new Effect.Tween(element, startVal, endVal, [options], callbackFunction);


No custom options.


    new Effect.Tween(whatever, 5, 0, 'blech'); // sets property on the object
    new Effect.Tween('foo', 10, 20, 'innerHTML'); // sets property on the 'foo' DOM element
    new Effect.Tween('foo', 10, 20, 'update'); // method call on 'foo' DOM element
    new Effect.Tween('foo', 50, 0, { duration: 2.0, afterFinish: function(){ /* do something else */} }, function(p){});
    new Effect.Tween(null, 0, 100, function(p){ scrollTo(0,p) }); // scrolls the window