Fader ConstructorSyntax: new
Fader(objects[,
start=1[,
end=0[,
duration=500[,
callbacks…]]]]);
The result of the default values is to fade out objects over a period of half a second. For example:
1. // Fade out this example code 2. new Fader("example"); 3. // Fade it back in 4. new Fader("example", 0, 1);
Execute the second line, then execute the fourth line
objectsstartenddurationcallbacks…cancel() method called.callbackscurrentOpacitystartOpacity immediately after the fader is created, and guranteed to be endOpacity after it has successfully completed.durationduration argument.endOpacityend argument.isCompletedcancel() or cancelSilently() has been called, false otherwise.objectobjects[0]—useful when only dealing with one element.objectsstartOpacitystart argument.addCallback(func)func to the array of callbacks.cancel()isCompleted to true. The opacity of the elements being faded is left at currentOpacity.cancelSilently()currentOpacity.isFadingIn()startOpacity is less than the endOpacity.isFadingOut()endOpacity is less than the startOpacity.getTimeElapsed()duration of the fader object.getTimeRemaining()duration - getTimeElapsed(). Guranteed to return no less than zero.removeCallback(func)func, returning true if successful.step()duration milliseconds.Callback functions are called in two cases: the completion of the animation, or if the cancel() method is called (the cancelSilently() method can be used to stop the fader without calling any callbacks). When called, they recieve two arguments: object, which is equivalent to the first element in the objects array, and the fader object itself.
Two ready-made callback functions are included: Fader.displayNone() and Fader.displayBlock(), which set the display of all elements in the fader's objects array to "none" and "block", respectively.
FaderFader.now()(new Date()).getTime().Fader.getElement(obj)document.getElementById():
returns document.getElementById(obj)
if obj is a string; otherwise returns
obj directly.Fader.displaySet(obj, fader, display)style.display property of every member of the fader.objects array to display -- wrapped by Fader.displayNone() and Fader.displayBlock()Fader.displayNone(obj, fader)style.display property of every member of the fader.objects array to "none".Fader.displayBlock(obj, fader)style.display property of every member of the fader.objects array to "block".