Skip to content

Commit

Permalink
Changed this file:
Browse files Browse the repository at this point in the history
modified:   anim/StyleTransition-test.html
  • Loading branch information
GarrettS committed Jul 25, 2009
1 parent 960805e commit 1a7eee0
Show file tree
Hide file tree
Showing 24 changed files with 42 additions and 272 deletions.
2 changes: 1 addition & 1 deletion build/anim/StyleTransition-min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

53 changes: 4 additions & 49 deletions build/anim/StyleTransition.js
Expand Up @@ -79,14 +79,8 @@ APE.extend(APE.anim.StyleTransition, APE.anim.Animation, {
this.style.zoom = "1"; this.style.zoom = "1";
fromValue = dom.getFilterOpacity(el); fromValue = dom.getFilterOpacity(el);
} else { } else {
if (prop == 'clip' units = dom.getStyleUnit(toValue);
&& (!fromValue || fromValue.indexOf("auto") != -1)) { fromValue = dom.findInheritedStyle(el, prop, units);
fromValue = "rect(0px " + el.offsetWidth + "px "
+ el.offsetHeight + "px 0px)";
} else {
units = dom.getStyleUnit(toValue);
fromValue = dom.findInheritedStyle(el, prop, units);
}
} }
// Get a ITransitionAdapter from the factory. // Get a ITransitionAdapter from the factory.
adapter = TransitionAdapterFactory.fromValues(prop, fromValue, adapter = TransitionAdapterFactory.fromValues(prop, fromValue,
Expand Down Expand Up @@ -147,8 +141,6 @@ APE.anim.TransitionAdapterFactory = {
} }
if (this.colorExp.test(prop)) if (this.colorExp.test(prop))
return new this.ColorTransitionAdapter(prop, fromValue, toValue); return new this.ColorTransitionAdapter(prop, fromValue, toValue);
if (prop == 'clip')
return new this.ClipTransitionAdapter(prop, fromValue, toValue);
if (this.lengthExp.test(fromValue)) { if (this.lengthExp.test(fromValue)) {
return new this.LengthTransitionAdapter(prop, fromValue, toValue); return new this.LengthTransitionAdapter(prop, fromValue, toValue);
} }
Expand Down Expand Up @@ -183,8 +175,7 @@ APE.anim.TransitionAdapterFactory = {
OpacityTransitionAdapter : OpacityTransitionAdapter, OpacityTransitionAdapter : OpacityTransitionAdapter,
FontWeightTransitionAdapter : FontWeightTransitionAdapter, FontWeightTransitionAdapter : FontWeightTransitionAdapter,
ThresholdTransitionAdapter : ThresholdTransitionAdapter, ThresholdTransitionAdapter : ThresholdTransitionAdapter,
ImmediateThresholdTransitionAdapter : ImmediateThresholdTransitionAdapter, ImmediateThresholdTransitionAdapter : ImmediateThresholdTransitionAdapter
ClipTransitionAdapter : ClipTransitionAdapter
}; };


APE.mixin(APE.anim.TransitionAdapterFactory, Adapters); APE.mixin(APE.anim.TransitionAdapterFactory, Adapters);
Expand Down Expand Up @@ -262,43 +253,7 @@ APE.anim.TransitionAdapterFactory = {
return v; return v;
}; };


var splitClipExp = /,?\s/, clipExp = /rect\(([^\)]+)\)/, zeroToPxExp = /0(\s|\))/g; var zeroToPxExp = /0(\s|\))/g;

function ClipTransitionAdapter(prop, fromValue, toValue) {
this.prop = "clip";

var fromString = clipExp.exec(fromValue.replace(zeroToPxExp, "0px$1"))[1], toString = clipExp
.exec(toValue.replace(zeroToPxExp, "0px$1"))[1];

this.fromValues = fromString.split(splitClipExp);
this.toValues = toString.split(splitClipExp);
this.clips = [];
this.values = [];
this.init();
}

ClipTransitionAdapter.prototype = {
init : function() {
for (var i = 0, f, t; i < 4; i++) {
f = this.fromValues[i], t = this.toValues[i];
if (f == "0")
f = "0px";
if (t == "0")
t = "0px";
this.clips[i] = new LengthTransitionAdapter(this.prop, f, t);
}
},

blendTo : function(rationalValue) {
for (var i = 0; i < 4; i++)
this.values[i] = this.clips[i].blendTo(rationalValue);
return "rect(" + this.values.join(" ") + ")";
},

toString : function() {
return "ClipTransitionAdapter: \n" + this.clips.join(" \n");
}
};


/** @ignore */ /** @ignore */
function OpacityTransitionAdapter(prop, fromValue, toValue) { function OpacityTransitionAdapter(prop, fromValue, toValue) {
Expand Down

0 comments on commit 1a7eee0

Please sign in to comment.