Allows per-property transitions for the animation of multiple CSS properties at once, even by a CSS selector.
var myFx = new Fx.TransMorph(element[, options]);
- element - (mixed) A string ID of the Element or an Element to apply the style transitions to.
- options - (object, optional) The Fx options object.
- (object) A new Fx.TransMorph instance.
var myEffect = new Fx.TransMorph('myElement', {duration: 'long'});
myEffect.start({
'height': [10, 100], //Morphs the 'height' style from 10px to 100px.
'width': [900, 300] //Morphs the 'width' style from 900px to 300px.
}, {
'width': Fx.Transitions.Elastic.easeOut //Morphs the 'width' with a cubicular transition
});
Same as Fx.Morph
Executes multiple transitions for any number of CSS properties in tandem.
myFx.start(properties, transitions);
- properties - (mixed) An object of key/value pairs of CSS attributes to change or a string representing a CSS selector which can be found within the CSS of the page. If only one value is given for any CSS property, the transition will be from the current value of that property to the value given.
- transitions - (object) An object of key/value pairs of transition functions or strings for each CSS attribute.
- (object) This Fx.TransMorph instance.
var myEffect = new Fx.TransMorph('myElement', {duration: 1000});
myEffect.start({
'height': [10, 100],
'width': [900, 300],
'opacity': 0,
'background-color': '#00f'
}, {
'width': Fx.Transitions.Elastic.easeOut,
'background-color': Fx.Transitions.Quad.easeInOut
});
Sets a default Fx.TransMorph instance for an Element.
el.set('transmorph'[, options]);
- options - (object, optional) The Fx.TransMorph options.
- (element) This Element.
el.set('transmorph', {duration: 'long'});
el.morph({height: 100, width: 100}, {width: 'bounce:out'});
Gets the default Fx.TransMorph instance for the Element.
el.get('transmorph');
- options - (object, optional) The Fx.TransMorph options. If these are passed in, a new instance will be generated.
- (object) The Fx.TransMorph instance.
el.set('transmorph', {duration: 'long'});
el.transmorph({height: 100, width: 100}, {width: 'bounce:out'});
el.get('transmorph'); //The Fx.TransMorph instance.
Animates an Element given the properties passed in.
myElement.transmorph(properties, transitions);
- properties - (mixed) The CSS properties to animate. Can be either an object of CSS properties or a string representing a CSS selector. If only one value is given for any CSS property, the transition will be from the current value of that property to the value given.
- transitions - (object) An object of key/value pairs of transition functions or strings for each CSS attribute.
- (element) This Element.
$('myElement').transmorph({height: 100, width: 200}, {width: 'bounce:out'});