11 Allows you to animate multiple css properties at once; Extends <Fx.Base>, inherits all its properties. Includes colors.
12 Colors must be in hex format.
15 el - the $(element) to apply the styles transition to
16 options - the fx options (see: <Fx.Base>)
20 var myEffects = new Fx.Styles('myElement', {duration: 1000, transition: Fx.Transitions.linear});
22 //height from 10 to 100 and width from 900 to 300
28 //or height from current height to 100 and width from current width to 300
36 Fx.Styles = Fx.Base.extend({
38 initialize: function(el, options){
44 for (var p in this.from) this.now[p] = this.css[p].getNow(this.from[p], this.to[p], this);
51 this.css[p] = Fx.CSS.select(p, to[p]);
52 parsed[p] = this.css[p].parse(to[p]);
54 return this.parent(parsed);
59 Executes a transition for any number of css properties in tandem.
62 obj - an object containing keys that specify css properties to alter and values that specify either the from/to values (as an array) or just the end value (an integer).
69 if (this.timer && this.options.wait) return this;
72 var from = {}, to = {};
74 var parsed = Fx.CSS.parse(this.element, p, obj[p]);
75 from[p] = parsed.from;
77 this.css[p] = parsed.css;
79 return this.parent(from, to);
83 for (var p in this.now) this.element.setStyle(p, this.css[p].getValue(this.now[p], this.options.unit, p));
90 Custom class to allow all of its methods to be used with any DOM element via the dollar function <$>.
97 Applies an <Fx.Styles> to the Element; This a shortcut for <Fx.Styles>.
100 >var myEffects = $(myElement).effects({duration: 1000, transition: Fx.Transitions.Sine.easeInOut});
101 >myEffects.start({'height': [10, 100], 'width': [900, 300]});
104 effects: function(options){
105 return new Fx.Styles(this, options);