new BaseTransition()
Class to execute transition on HTML elements.
This is the base (abstract class), concrete job need to be done in descendants.
Properties:
Name | Type | Description |
---|---|---|
caller |
HTMLElement | Who calls this transition. Usually a base HTML element of a widget. |
element |
HTMLElement | The element to run the transition. |
Methods
-
canExecute(element, options)
-
Return if transition can be executed in current browser and element.
Parameters:
Name Type Description element
HTMLElement options
Hash Transition options. -
doExecute(element, caller, callback, options)
-
Do actual job of execute. Descendants should override this method.
Parameters:
Name Type Description element
HTMLElement caller
HTMLElement callback
function Function that will be called when the transition is done. This function has no parameters. options
Hash Transition options. -
doHalt(transitionInfo)
-
Do actual work of halt, descendants should override this method.
Parameters:
Name Type Description transitionInfo
Object -
execute(element, caller, callback, options) → {Object}
-
Execute transition on element, from and to is the position of the begin and end of transition. Those position values are in 0..1. In appear/disappear transition, 0 means invisible and 1 means totally visible.
Parameters:
Name Type Description element
HTMLElement caller
HTMLElement callback
function Function that will be called when the transition is done. This function has no parameters. options
Hash Transition options, can include the following fields: { from: Float, the starting position of transition. For appear/disappear transition, 0 means hidden and 1 means totally shown. to: Float, the ending position of transition. For appear/disappear transition, 0 means hidden and 1 means totally shown. duration: Int, in millisecond, the duration of transition. callerRect: {left, top, width, height}, explicitly set the page rect of caller ... } Different transition may has more properties here. Returns:
Transition info, an object that contains the basic information of transition, including: {element, caller, callback, options, executor(this)}.- Type
- Object
-
finish(element, caller, options)
-
Called after the transition is done. Usually some properties of element (position, color and so on) need to be restored after execution. Descendants need to override this method to do their own job.
Parameters:
Name Type Description element
HTMLElement caller
HTMLElement options
Hash -
halt(transitionInfo)
-
Stop and jump to the end of a executing transition.
Parameters:
Name Type Description transitionInfo
Object Transition info object returned by Kekule.Widget.BaseTransition.execute. -
setElementProp(element, position, options)
-
Prepare HTML element before transition executing. Set property properly according to transition position. Descendants should override this method.
Parameters:
Name Type Description element
HTMLElement position
Float options
Hash