1 Class: Fx.Morph {#Fx-Morph}
2 ===========================
4 Allows for the animation of multiple CSS properties at once, even by a simple CSS selector. Inherits methods, properties, options and events from [Fx][].
12 var myFx = new Fx.Morph(element[, options]);
16 1. element - (*mixed*) A string ID of the Element or an Element to apply the style transitions to.
17 2. options - (*object*, optional) The [Fx][] options object.
21 * (*object*) A new Fx.Morph instance.
25 Multiple styles with start and end values using an object:
27 var myEffect = new Fx.Morph('myElement', {
29 transition: Fx.Transitions.Sine.easeOut
33 'height': [10, 100], // Morphs the 'height' style from 10px to 100px.
34 'width': [900, 300] // Morphs the 'width' style from 900px to 300px.
38 Multiple styles with the start value omitted will default to the current Element's value:
40 var myEffect = new Fx.Morph('myElement', {
42 transition: Fx.Transitions.Sine.easeOut
46 'height': 100, // Morphs the height from the current to 100px.
47 'width': 300 // Morphs the width from the current to 300px.
51 Morphing one Element to match the CSS values within a CSS class. This is useful when
52 separating the logic and styles:
54 var myEffect = new Fx.Morph('myElement', {
56 transition: Fx.Transitions.Sine.easeOut
59 // the styles of myClassName will be applied to the target Element.
60 myEffect.start('.myClassName');
64 - This feature only works for simple selectors like a single class or id due to limited browser support for complex selectors.
72 Fx.Morph Method: set {#Fx-Morph:set}
73 ------------------------------------
75 Sets the Element's CSS properties to the specified values immediately.
83 1. properties - (*mixed*) Either 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.
87 * (*object*) This Fx.Morph instance.
91 var myFx = new Fx.Morph('myElement').set({
94 'background-color': '#f00',
97 var myFx = new Fx.Morph('myElement').set('.myClass');
101 Fx.Morph Method: start {#Fx-Morph:start}
102 ----------------------------------------
104 Executes a transition for any number of CSS properties in tandem.
108 myFx.start(properties);
112 1. 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.
113 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.
117 * (*object*) This Fx.Morph instance.
121 var myEffects = new Fx.Morph('myElement', {duration: 1000, transition: Fx.Transitions.Sine.easeOut});
127 'background-color': '#00f'
132 - If a string is passed as the CSS selector, the selector must be identical to the one within the CSS.
133 - Multiple selectors (with commas) are not supported.
134 - @import'ed CSS rules will not be available for Morph calls. All CSS selectors must be present in CSS directly loaded into the page.
137 Object: Element.Properties {#Element-Properties}
138 ==============================================
140 see [Element.Properties][]
142 Element Property: morph {#Element-Properties:morph}
143 ---------------------------------------------------
147 Sets a default Fx.Morph instance for an Element.
151 el.set('morph'[, options]);
155 1. options - (*object*, optional) The Fx.Morph options.
159 * (*element*) This Element.
163 el.set('morph', {duration: 'long', transition: 'bounce:out'});
164 el.morph({height: 100, width: 100});
168 Gets the default Fx.Morph instance for the Element.
176 1. property - (*string*) the Fx.Morph property argument.
180 * (*object*) The Fx.Morph instance.
184 el.set('morph', {duration: 'long', transition: 'bounce:out'});
185 el.morph({height: 100, width: 100});
186 el.get('morph'); // the Fx.Morph instance.
190 Type: Element {#Element}
191 ==========================
193 Element Method: morph {#Element:morph}
194 --------------------------------------
196 Animates an Element given the properties passed in.
200 myElement.morph(properties);
204 1. 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.
208 * (*element*) This Element.
214 $('myElement').morph({height: 100, width: 200});
218 $('myElement').morph('.class1');
226 [$]: /core/Element/Element#Window:dollar
228 [Fx.Morph]: #Fx-Morph
229 [Element.Properties]: /core/Element/Element/#Element-Properties