0
@@ -2,39 +2,39 @@ Effect.Operators.Style = Class.create(Effect.Operators.Base, {
0
initialize: function($super, object, options) {
0
$super(object, options);
0
this.element = $(this.object);
0
if (!this.options.propertyTransitions)
0
- this.options.propertyTransitions = { }
0
+ this.options.propertyTransitions = { }
;0
for (property in this.options.propertyTransitions)
0
this.options.propertyTransitions[property] =
0
Object.propertize(this.options.propertyTransitions[property], Effect.Transitions);
0
if (!Object.isString(this.options.style)) {
0
this.style = $H(this.options.style);
0
if (this.options.style.include(':')) {
0
this.style = $H(CSS.parseStyle(this.options.style));
0
this.element.addClassName(options.style);
0
this.style = $H(this.element.getStyles());
0
this.element.removeClassName(options.style);
0
var css = this.element.getStyles();
0
this.style = this.style.reject(function(style) { return style.value == css[style.key] });
0
this.tweens = this.style.map(function(pair) {
0
- var property = pair[0].camelize(), target = pair[1], unit = '', tween,
0
+ var property = pair[0].camelize(), target = pair[1], unit = '', tween,
0
source = this.element.getStyle(property);
0
if (CSS.COLOR_PROPERTIES.include(property)) {
0
if (source == target) return;
0
source = CSS.Color.normalize(source);
0
- target = CSS.Color.normalize(target); unit = 'color';
0
+ target = CSS.Color.normalize(target); unit = 'color';
0
tween = function(currentStyle, style, position) {
0
position = (this.options.propertyTransitions[property] || Effect.Transitions.linear)(position);
0
var value = '#' + [0,1,2].map(function(index){
0
@@ -48,7 +48,7 @@ Effect.Operators.Style = Class.create(Effect.Operators.Base, {
0
target = components[1];
0
unit = String.interpret((components.length == 3) ? components[2] : null);
0
- source = parseFloat(source); target = parseFloat(target);
0
+ source = parseFloat(source); target = parseFloat(target);
0
if (isNaN(source) || isNaN(target) || source == target) return;
0
tween = function(currentStyle, style, position) {
0
position = (this.options.propertyTransitions[property] || Effect.Transitions.linear)(position);
0
@@ -57,17 +57,17 @@ Effect.Operators.Style = Class.create(Effect.Operators.Base, {
0
- }
.bind(this)).compact();
0
valueAt: function(position) {
0
var style = { }, currentStyle = this.currentStyle || { };
0
this.tweens.each( function(tween){
0
- tween(currentStyle, style, position)
0
+ tween(currentStyle, style, position)
;0
applyValue: function(value) {
0
this.element.setStyle(value);
0
this.currentStyle = value;