Fx.MorphElement is a class that extends Fx.Morph to add an easy way to add some common effects to any element using CSS Styles.
Inherits methods, properties, options and events from Fx.Morph.
- MooTools Core 1.2.4: Fx.Morph, Fx.Transitions (and their dependencies)
#JS
var myFx = new Fx.MorphElement(el, {options});
- el - (element) the id of the element or the element itself.
- options - (options) a key/value set of options.
- width: (string), the width of the element. (Default: the width of the actual element)
- height: (string), the height of the element. (Default: the height of the actual element)
- wrap: (boolean), whether to wrap the element or not. (Default: true)
- wrapClass: (string), The CSS Class name of the element wrap. (Default: 'morphElementWrap')
- FxTransition : An Fx.Transitions (object). see MooTools Fx for options. (Default: {transition: 'linear', duration, 'long'}),
- hideOnInitialize: (mixed), whether to hide the element when the class is initialize using a style from Fx.MorphElement.Effects. (Default: false)
- (object) A new Fx.MorphElement instance.
Morphing using an object:
#JS
var myFx = new Fx.MorphElement($('me1'), {
wrap: true,
width: '200px',
height: '200px',
FxTransition: {
transition: 'linear',
duration: 'long'
},
hideOnInitialize: 'slide:right'
});
myFx.start('slide:right');
Executes a transition from the Fx.MorphElement.Effects (object).
#JS
myFx.start(properties);
- properties - (string) An string representing a CSS styles which can be found within the Fx.MorphElement.Effects (object).
- (object) This Fx.MorphElement instance.
#JS
var myEffects = new Fx.MorphElement('myElement', {
wrap: true,
width: '200px',
height: '200px',
FxTransition: {
transition: 'linear',
duration: 'long'
},
hideOnInitialize: 'slide:up'
});
myEffects.start('slide:up');
Sets a default Fx.MorphElement instance for an Element.
#JS
el.set('morphElement', options);
- options - (object) The Fx.MorphElement options.
- (element) This Element.
#JS
el.set('morphElement', {
FxTransition: {
duration: 'long',
transition: 'bounce:out'
}
});
el.morphElement('slide:down');
Gets the default Fx.MorphElement instance for the Element.
#JS
el.get('morphElement');
- options - (object, optional) The Fx.MorphElement options. If these are passed in, a new instance will be generated.
- (object) The Fx.MorphElement instance.
el.set('morph', {
FxTransition: {
duration: 'long',
transition: 'bounce:out'
}
});
el.morphElement('blind:left');
el.get('morphElement'); //The Fx.MorphElement instance.
Animates an Element given the properties passed in.
#JS
myElement.morphElement(properties);
- properties - (string) The CSS properties in the Fx.MorphElement.Effects (object) to animate.
- (element) This Element.
#JS
$('myElement').morphElement('slide:left');
A Hash (object) that holds all the styles for the effect to transition.
- blind:up
- blind:down
- blind:left
- blind:right
- slide:up
- slide:down
- slide:left
- slide:right
- fade