Skip to content

Commit

Permalink
starting on patching animate
Browse files Browse the repository at this point in the history
  • Loading branch information
unknown committed May 16, 2010
1 parent c4ffa06 commit 2414182
Showing 1 changed file with 19 additions and 9 deletions.
28 changes: 19 additions & 9 deletions lib/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,18 @@
};

// Extend the jQuery animation to handle transform function
var _animate = $.fn.animate;
$.fn.animate = function( prop, speed, easing, callback ) {
var style = this[0].style;
jQuery.each( prop, function( name, val ) {
// clean up the numbers for multivalue properties we care about
if ($.inArray(transformFuncs, name)) {
console.log(style[name] === undefined);
}
});
return _animate.apply(this, arguments);
}

/**
* Detects the existence of a space separated value
* @param Boolean force
Expand All @@ -92,10 +104,8 @@
if (rfxmultinum.test(value)) {
value = value.split(/\s/)[0];
}
if (unitless.test(this.prop) && !value && value !== 0) {
value = 1;
} else if (!value && value !== 0) {
value = 0;
if (!value && value !== 0) {
value = unitless.test(this.prop) ? 1 : 0;
}
return parseFloat(value);
}
Expand Down Expand Up @@ -161,19 +171,19 @@
$.fx.step[attr] = function(fx) {
// Initialize the transformation
if (!fx.transformInit) {
console.log(fx.options.curAnim);
fx.transform = new Transform(fx.elem);

// Correct for start being NaN
if (isNaN(fx.start)) {
//console.log(fx);
fx.start = fx.transform.getAttribute(fx.prop, true);
if ($.isArray(fx.start)) {
fx.start = fx.start[0];
}
var end = fx.end;
if (/\s/.test(fx.end)) {
var end = fx.end.split(/\s/)[0];
}
//var end = fx.end;
//if (/\s/.test(fx.end)) {
// end = fx.end.split(/\s/)[0];
//}
fx.now = fx.start + ((fx.end - fx.start) * fx.pos);
}

Expand Down

0 comments on commit 2414182

Please sign in to comment.