Deploying to gh-pages from @ cappuccino/cappuccino@1376466939 🚀

This commit is contained in:
daboe01 committed 2025-11-19 18:19:08 +00:00
1 parent 7f49f0d168
commit 8395f6fb04
4 files changed
+810 -211

No files matched your search

+198 -8
View File
@@ -6218,7 +6218,7 @@ var meta_class = the_class.isa;class_addMethods(the_class, [new objj_method(sel_
,["void"])]);
}
p;14;CPBezierPath.jt;11619;@STATIC;1.0;I;21;Foundation/CPObject.ji;19;CPGraphicsContext.jt;11549;objj_executeFile("Foundation/CPObject.j", NO);objj_executeFile("CPGraphicsContext.j", YES);var DefaultLineWidth = 1.0;
p;14;CPBezierPath.jt;12989;@STATIC;1.0;I;21;Foundation/CPObject.ji;19;CPGraphicsContext.jt;12919;objj_executeFile("Foundation/CPObject.j", NO);objj_executeFile("CPGraphicsContext.j", YES);var DefaultLineWidth = 1.0;
{var the_class = objj_allocateClassPair(CPObject, "CPBezierPath"),
meta_class = the_class.isa;class_addIvars(the_class, [new objj_ivar("_path", "CGPath"), new objj_ivar("_lineWidth", "float"), new objj_ivar("_lineDashes", "CPArray"), new objj_ivar("_lineDashesPhase", "float")]);objj_registerClassPair(the_class);
@@ -6450,6 +6450,40 @@ class_addMethods(meta_class, [new objj_method(sel_getUid("bezierPath"), function
,["void","CGPoint","CGPoint"])]);
}
{
var the_class = objj_getClass("CPBezierPath")
if(!the_class) throw new SyntaxError("*** Could not find definition for class \"CPBezierPath\"");
var meta_class = the_class.isa;class_addMethods(the_class, [new objj_method(sel_getUid("SVGString"), function $CPBezierPath__SVGString(self, _cmd)
{
var pathString = "";
var elements = self._path.elements;
var count = self._path.count;
for (var i = 0; i < count; i++)
{
var element = elements[i];
switch(element.type) {
case kCGPathElementMoveToPoint:
pathString += "M " + element.x + " " + element.y + " ";
break;
case kCGPathElementAddLineToPoint:
pathString += "L " + element.x + " " + element.y + " ";
break;
case kCGPathElementAddQuadCurveToPoint:
pathString += "Q " + element.cpx + " " + element.cpy + " " + element.x + " " + element.y + " ";
break;
case kCGPathElementAddCurveToPoint:
pathString += "C " + element.cp1x + " " + element.cp1y + " " + element.cp2x + " " + element.cp2y + " " + element.x + " " + element.y + " ";
break;
case kCGPathElementCloseSubpath:
pathString += "Z ";
break;
}
}
return pathString.trim();
}
,["CPString"])]);
}
p;7;CPBox.jt;45800;@STATIC;1.0;i;13;CPTextField.ji;8;CPView.jI;23;Foundation/CPGeometry.jt;45722;objj_executeFile("CPTextField.j", YES);objj_executeFile("CPView.j", YES);objj_executeFile("Foundation/CPGeometry.j", NO);{var the_typedef = objj_allocateTypeDef("CPBoxType");
objj_registerTypeDef(the_typedef);
}CPBoxPrimary = 0;
@@ -50130,9 +50164,16 @@ class_addMethods(the_class, [new objj_method(sel_getUid("init"), function $CABas
,["id"])]);
}
p;21;CAKeyframeAnimation.jt;1968;@STATIC;1.0;I;21;Foundation/CPObject.ji;21;CAPropertyAnimation.jt;1897;objj_executeFile("Foundation/CPObject.j", NO);objj_executeFile("CAPropertyAnimation.j", YES);
p;21;CAKeyframeAnimation.jt;4732;@STATIC;1.0;I;21;Foundation/CPObject.ji;21;CAPropertyAnimation.jt;4661;objj_executeFile("Foundation/CPObject.j", NO);objj_executeFile("CAPropertyAnimation.j", YES);kCAAnimationLinear = "linear";
kCAAnimationDiscrete = "discrete";
kCAAnimationPaced = "paced";
kCAAnimationCubic = "cubic";
kCAAnimationCubicPaced = "cubicPaced";
kCAAnimationRotateAuto = "auto";
kCAAnimationRotateAutoReverse = "autoReverse";
{var the_class = objj_allocateClassPair(CAPropertyAnimation, "CAKeyframeAnimation"),
meta_class = the_class.isa;class_addIvars(the_class, [new objj_ivar("_values", "CPArray"), new objj_ivar("_keyTimes", "CPArray"), new objj_ivar("_timingFunctions", "CPArray")]);objj_registerClassPair(the_class);
meta_class = the_class.isa;class_addIvars(the_class, [new objj_ivar("_values", "CPArray"), new objj_ivar("_keyTimes", "CPArray"), new objj_ivar("_timingFunctions", "CPArray"), new objj_ivar("_path", "id"), new objj_ivar("_calculationMode", "CPString"), new objj_ivar("_rotationMode", "CPString"), new objj_ivar("_tensionValues", "CPArray"), new objj_ivar("_continuityValues", "CPArray"), new objj_ivar("_biasValues", "CPArray")]);objj_registerClassPair(the_class);
class_addMethods(the_class, [new objj_method(sel_getUid("values"), function $CAKeyframeAnimation__values(self, _cmd)
{
return self._values;
@@ -50163,12 +50204,75 @@ class_addMethods(the_class, [new objj_method(sel_getUid("values"), function $CAK
self._timingFunctions = newValue;
}
,["void","CPArray"]), new objj_method(sel_getUid("path"), function $CAKeyframeAnimation__path(self, _cmd)
{
return self._path;
}
,["id"]), new objj_method(sel_getUid("setPath:"), function $CAKeyframeAnimation__setPath_(self, _cmd, newValue)
{
self._path = newValue;
}
,["void","id"]), new objj_method(sel_getUid("calculationMode"), function $CAKeyframeAnimation__calculationMode(self, _cmd)
{
return self._calculationMode;
}
,["CPString"]), new objj_method(sel_getUid("setCalculationMode:"), function $CAKeyframeAnimation__setCalculationMode_(self, _cmd, newValue)
{
self._calculationMode = newValue;
}
,["void","CPString"]), new objj_method(sel_getUid("rotationMode"), function $CAKeyframeAnimation__rotationMode(self, _cmd)
{
return self._rotationMode;
}
,["CPString"]), new objj_method(sel_getUid("setRotationMode:"), function $CAKeyframeAnimation__setRotationMode_(self, _cmd, newValue)
{
self._rotationMode = newValue;
}
,["void","CPString"]), new objj_method(sel_getUid("tensionValues"), function $CAKeyframeAnimation__tensionValues(self, _cmd)
{
return self._tensionValues;
}
,["CPArray"]), new objj_method(sel_getUid("setTensionValues:"), function $CAKeyframeAnimation__setTensionValues_(self, _cmd, newValue)
{
self._tensionValues = newValue;
}
,["void","CPArray"]), new objj_method(sel_getUid("continuityValues"), function $CAKeyframeAnimation__continuityValues(self, _cmd)
{
return self._continuityValues;
}
,["CPArray"]), new objj_method(sel_getUid("setContinuityValues:"), function $CAKeyframeAnimation__setContinuityValues_(self, _cmd, newValue)
{
self._continuityValues = newValue;
}
,["void","CPArray"]), new objj_method(sel_getUid("biasValues"), function $CAKeyframeAnimation__biasValues(self, _cmd)
{
return self._biasValues;
}
,["CPArray"]), new objj_method(sel_getUid("setBiasValues:"), function $CAKeyframeAnimation__setBiasValues_(self, _cmd, newValue)
{
self._biasValues = newValue;
}
,["void","CPArray"]), new objj_method(sel_getUid("init"), function $CAKeyframeAnimation__init(self, _cmd)
{
self = (objj_getClass("CAKeyframeAnimation").super_class.method_dtable["init"] || _objj_forward)(self, "init");
self._values = (CPArray.isa.method_msgSend["array"] || _objj_forward)(CPArray, "array");
self._keyTimes = (CPArray.isa.method_msgSend["array"] || _objj_forward)(CPArray, "array");
self._timingFunctions = (CPArray.isa.method_msgSend["array"] || _objj_forward)(CPArray, "array");
self._tensionValues = (CPArray.isa.method_msgSend["array"] || _objj_forward)(CPArray, "array");
self._continuityValues = (CPArray.isa.method_msgSend["array"] || _objj_forward)(CPArray, "array");
self._biasValues = (CPArray.isa.method_msgSend["array"] || _objj_forward)(CPArray, "array");
return self;
}
@@ -50990,7 +51094,7 @@ class_addMethods(meta_class, [new objj_method(sel_getUid("animationWithKeyPath:"
,["id","CPString"])]);
}
p;20;CPAnimationContext.jt;28637;@STATIC;1.0;i;18;CABasicAnimation.ji;21;CAKeyframeAnimation.ji;8;CPView.jI;20;Foundation/CPTimer.jI;22;Foundation/CPRunLoop.jt;28504;objj_executeFile("CABasicAnimation.j", YES);objj_executeFile("CAKeyframeAnimation.j", YES);objj_executeFile("CPView.j", YES);objj_executeFile("Foundation/CPTimer.j", NO);objj_executeFile("Foundation/CPRunLoop.j", NO);{var the_typedef = objj_allocateTypeDef("Map");
p;20;CPAnimationContext.jt;29938;@STATIC;1.0;i;18;CABasicAnimation.ji;21;CAKeyframeAnimation.ji;8;CPView.jI;20;Foundation/CPTimer.jI;22;Foundation/CPRunLoop.jt;29805;objj_executeFile("CABasicAnimation.j", YES);objj_executeFile("CAKeyframeAnimation.j", YES);objj_executeFile("CPView.j", YES);objj_executeFile("Foundation/CPTimer.j", NO);objj_executeFile("Foundation/CPRunLoop.j", NO);{var the_typedef = objj_allocateTypeDef("Map");
objj_registerTypeDef(the_typedef);
};
var _CPAnimationContextStack = nil,
@@ -51078,6 +51182,13 @@ class_addMethods(the_class, [new objj_method(sel_getUid("duration"), function $C
values = (animation == null ? animation : (animation.isa.method_msgSend["values"] || _objj_forward)(animation, "values"));
keyTimes = (animation == null ? animation : (animation.isa.method_msgSend["keyTimes"] || _objj_forward)(animation, "keyTimes"));
timingFunctions = (animation == null ? animation : (animation.isa.method_msgSend["timingFunctionsControlPoints"] || _objj_forward)(animation, "timingFunctionsControlPoints"));
var path = (animation == null ? animation : (animation.isa.method_msgSend["path"] || _objj_forward)(animation, "path"));
var calculationMode = (animation == null ? animation : (animation.isa.method_msgSend["calculationMode"] || _objj_forward)(animation, "calculationMode")) || kCAAnimationLinear;
var rotationMode = (animation == null ? animation : (animation.isa.method_msgSend["rotationMode"] || _objj_forward)(animation, "rotationMode"));
var tensionValues = (animation == null ? animation : (animation.isa.method_msgSend["tensionValues"] || _objj_forward)(animation, "tensionValues"));
var continuityValues = (animation == null ? animation : (animation.isa.method_msgSend["continuityValues"] || _objj_forward)(animation, "continuityValues"));
var biasValues = (animation == null ? animation : (animation.isa.method_msgSend["biasValues"] || _objj_forward)(animation, "biasValues"));
return {object: anObject, root: anObject, keypath: animatedKeyPath, duration: duration, completion: completionFunction, values: values, keytimes: keyTimes, timingfunctions: timingFunctions, path: path, calculationMode: calculationMode, rotationMode: rotationMode, tensionValues: tensionValues, continuityValues: continuityValues, biasValues: biasValues};
}
else
{
@@ -51091,8 +51202,8 @@ class_addMethods(the_class, [new objj_method(sel_getUid("duration"), function $C
values = [fromValue, toValue];
keyTimes = [0, 1];
timingFunctions = isBasicAnimation ? (animation == null ? animation : (animation.isa.method_msgSend["timingFunctionControlPoints"] || _objj_forward)(animation, "timingFunctionControlPoints")) : ((___r1 = self._timingFunction), ___r1 == null ? ___r1 : (___r1.isa.method_msgSend["controlPoints"] || _objj_forward)(___r1, "controlPoints"));
return {object: anObject, root: anObject, keypath: animatedKeyPath, values: values, keytimes: keyTimes, duration: duration, timingfunctions: timingFunctions, completion: completionFunction};
}
return {object: anObject, root: anObject, keypath: animatedKeyPath, values: values, keytimes: keyTimes, duration: duration, timingfunctions: timingFunctions, completion: completionFunction};
var ___r1;
}
@@ -51443,7 +51554,7 @@ var _animationFlushingObserverCallback = function()
_animationFlushingObserver = nil;
}
};
p;16;CPViewAnimator.jt;24204;@STATIC;1.0;i;19;_CPObjectAnimator.ji;8;CPView.ji;17;CPCompatibility.ji;14;CSSAnimation.jt;24107;objj_executeFile("_CPObjectAnimator.j", YES);objj_executeFile("CPView.j", YES);objj_executeFile("CPCompatibility.j", YES);objj_executeFile("CSSAnimation.j", YES);var DEFAULT_CSS_PROPERTIES = nil,
p;16;CPViewAnimator.jt;27643;@STATIC;1.0;i;19;_CPObjectAnimator.ji;8;CPView.ji;17;CPCompatibility.ji;14;CSSAnimation.jt;27546;objj_executeFile("_CPObjectAnimator.j", YES);objj_executeFile("CPView.j", YES);objj_executeFile("CPCompatibility.j", YES);objj_executeFile("CSSAnimation.j", YES);var DEFAULT_CSS_PROPERTIES = nil,
FRAME_UPDATERS = {};
{var the_class = objj_allocateClassPair(_CPObjectAnimator, "CPViewAnimator"),
@@ -51557,6 +51668,10 @@ class_addMethods(meta_class, [new objj_method(sel_getUid("_defaultCSSProperties"
,["CPDictionary"]), new objj_method(sel_getUid("addAnimations:forAction:"), function $CPViewAnimator__addAnimations_forAction_(self, _cmd, animations, anAction)
{
var target = anAction.object;
if (anAction.path)
{
return (self.isa.method_msgSend["_addPathAnimation:forAction:domElement:identifier:"] || _objj_forward)(self, "_addPathAnimation:forAction:domElement:identifier:", animations, anAction, (target == null ? target : (target.isa.method_msgSend["_DOMElement"] || _objj_forward)(target, "_DOMElement")), (target == null ? target : (target.isa.method_msgSend["UID"] || _objj_forward)(target, "UID")));
}
return (self.isa.method_msgSend["_addAnimations:forAction:domElement:identifier:"] || _objj_forward)(self, "_addAnimations:forAction:domElement:identifier:", animations, anAction, (target == null ? target : (target.isa.method_msgSend["_DOMElement"] || _objj_forward)(target, "_DOMElement")), (target == null ? target : (target.isa.method_msgSend["UID"] || _objj_forward)(target, "UID")));
}
@@ -51571,17 +51686,88 @@ class_addMethods(meta_class, [new objj_method(sel_getUid("_defaultCSSProperties"
animation = new CSSAnimation(aDomElement, anIdentifier, ((___r1 = anAction.object), ___r1 == null ? ___r1 : (___r1.isa.method_msgSend["debug_description"] || _objj_forward)(___r1, "debug_description")));
(animations == null ? animations : (animations.isa.method_msgSend["addObject:"] || _objj_forward)(animations, "addObject:", animation));
}
var calculationMode = anAction.calculationMode;
var timingFunctions = anAction.timingfunctions;
if (calculationMode === kCAAnimationDiscrete)
{
timingFunctions = "steps(1, end)";
}
var css_mapping = (self.isa.method_msgSend["_cssPropertiesForKeyPath:"] || _objj_forward)(self, "_cssPropertiesForKeyPath:", anAction.keypath);
(css_mapping == null ? css_mapping : (css_mapping.isa.method_msgSend["enumerateObjectsUsingBlock:"] || _objj_forward)(css_mapping, "enumerateObjectsUsingBlock:", function(aDict, anIndex, stop)
{
var completionFunction = anIndex == 0 ? anAction.completion : null,
property = (aDict == null ? aDict : (aDict.isa.method_msgSend["objectForKey:"] || _objj_forward)(aDict, "objectForKey:", "property")),
getter = (aDict == null ? aDict : (aDict.isa.method_msgSend["objectForKey:"] || _objj_forward)(aDict, "objectForKey:", "value"));
animation.addPropertyAnimation(property, getter, anAction.duration, anAction.keytimes, anAction.values, anAction.timingfunctions, completionFunction);
animation.addPropertyAnimation(property, getter, anAction.duration, anAction.keytimes, anAction.values, timingFunctions, completionFunction);
}));
var ___r1;
}
,["void","CPArray","id","Object","CPString"]), new objj_method(sel_getUid("_addPathAnimation:forAction:domElement:identifier:"), function $CPViewAnimator___addPathAnimation_forAction_domElement_identifier_(self, _cmd, animations, anAction, aDomElement, anIdentifier)
{
var animation = (animations == null ? animations : (animations.isa.method_msgSend["objectPassingTest:"] || _objj_forward)(animations, "objectPassingTest:", function(anim, idx, stop)
{
return anim.identifier == anIdentifier;
}));
if (animation == nil)
{
animation = new CSSAnimation(aDomElement, anIdentifier, ((___r1 = anAction.object), ___r1 == null ? ___r1 : (___r1.isa.method_msgSend["debug_description"] || _objj_forward)(___r1, "debug_description")));
(animations == null ? animations : (animations.isa.method_msgSend["addObject:"] || _objj_forward)(animations, "addObject:", animation));
}
var svgPath = ((___r1 = anAction.path), ___r1 == null ? ___r1 : (___r1.isa.method_msgSend["SVGString"] || _objj_forward)(___r1, "SVGString"));
aDomElement.style.offsetPath = "path('" + svgPath + "')";
if (anAction.keypath === "frameOrigin")
{
aDomElement.style.offsetAnchor = "0% 0%";
aDomElement.style.left = "0px";
aDomElement.style.top = "0px";
}
else
{
aDomElement.style.offsetAnchor = "50% 50%";
}
var rotationMode = anAction.rotationMode;
if (rotationMode === kCAAnimationRotateAuto)
{
aDomElement.style.offsetRotate = "auto";
}
else if (rotationMode === kCAAnimationRotateAutoReverse)
{
aDomElement.style.offsetRotate = "auto reverse";
}
else
{
aDomElement.style.offsetRotate = "0deg";
}
var originalCompletion = anAction.completion;
var cleanupCompletion = function()
{
if (originalCompletion)
originalCompletion();
aDomElement.style.offsetPath = null;
aDomElement.style.offsetAnchor = null;
aDomElement.style.offsetRotate = null;
};
var getter = function(start, current)
{
return current;
};
var values = ["0%", "100%"];
var keytimes = [0, 1];
var timingfunctions;
if (anAction.calculationMode === kCAAnimationPaced)
{
timingfunctions = "linear";
}
else
{
timingfunctions = ((___r1 = (CPAnimationContext.isa.method_msgSend["currentContext"] || _objj_forward)(CPAnimationContext, "currentContext")), ___r1 == null ? ___r1 : (___r1.isa.method_msgSend["timingFunction"] || _objj_forward)(___r1, "timingFunction"));
}
animation.addPropertyAnimation("offset-distance", getter, anAction.duration, keytimes, values, timingfunctions, cleanupCompletion);
animation.setFillMode("forwards");
var ___r1;
}
,["void","CPArray","id","Object","CPString"]), new objj_method(sel_getUid("_cssPropertiesForKeyPath:"), function $CPViewAnimator___cssPropertiesForKeyPath_(self, _cmd, aKeyPath)
{
return ((___r1 = (self.isa.method_msgSend["_defaultCSSProperties"] || _objj_forward)(self, "_defaultCSSProperties")), ___r1 == null ? ___r1 : (___r1.isa.method_msgSend["objectForKey:"] || _objj_forward)(___r1, "objectForKey:", aKeyPath));
@@ -51833,7 +52019,7 @@ var createUpdateFrame = function(aView, aKeyPath)
};
return updateFrame;
};
p;14;CSSAnimation.jt;8703;@STATIC;1.0;t;8684;var ANIMATIONS_GLOBAL_ID = 0,
p;14;CSSAnimation.jt;8841;@STATIC;1.0;t;8822;var ANIMATIONS_GLOBAL_ID = 0,
CURRENT_ANIMATIONS = {},
ANIMATION_END_EVENT_NAME,
ANIMATION_PROPERTY,
@@ -52058,6 +52244,10 @@ CSSAnimation.prototype.start = function()
this.islive = true;
return true;
};
CSSAnimation.prototype.setFillMode = function(aProperty)
{
this.target.style.setProperty(ANIMATION_FILL_MODE_PROPERTY, aProperty);
};
p;19;CGAffineTransform.jt;5247;@STATIC;1.0;i;12;CGGeometry.jt;5211;objj_executeFile("CGGeometry.j", YES);{var the_typedef = objj_allocateTypeDef("CGAffineTransform");
objj_registerTypeDef(the_typedef);
}CGAffineTransformMake = function(a, b, c, d, tx, ty)
@@ -5829,7 +5829,7 @@ var meta_class = the_class.isa;class_addMethods(the_class, [new objj_method(sel_
,["void"])]);
}
p;14;CPBezierPath.jt;11619;@STATIC;1.0;I;21;Foundation/CPObject.ji;19;CPGraphicsContext.jt;11549;objj_executeFile("Foundation/CPObject.j", NO);objj_executeFile("CPGraphicsContext.j", YES);var DefaultLineWidth = 1.0;
p;14;CPBezierPath.jt;12989;@STATIC;1.0;I;21;Foundation/CPObject.ji;19;CPGraphicsContext.jt;12919;objj_executeFile("Foundation/CPObject.j", NO);objj_executeFile("CPGraphicsContext.j", YES);var DefaultLineWidth = 1.0;
{var the_class = objj_allocateClassPair(CPObject, "CPBezierPath"),
meta_class = the_class.isa;class_addIvars(the_class, [new objj_ivar("_path", "CGPath"), new objj_ivar("_lineWidth", "float"), new objj_ivar("_lineDashes", "CPArray"), new objj_ivar("_lineDashesPhase", "float")]);objj_registerClassPair(the_class);
@@ -6061,6 +6061,40 @@ class_addMethods(meta_class, [new objj_method(sel_getUid("bezierPath"), function
,["void","CGPoint","CGPoint"])]);
}
{
var the_class = objj_getClass("CPBezierPath")
if(!the_class) throw new SyntaxError("*** Could not find definition for class \"CPBezierPath\"");
var meta_class = the_class.isa;class_addMethods(the_class, [new objj_method(sel_getUid("SVGString"), function $CPBezierPath__SVGString(self, _cmd)
{
var pathString = "";
var elements = self._path.elements;
var count = self._path.count;
for (var i = 0; i < count; i++)
{
var element = elements[i];
switch(element.type) {
case kCGPathElementMoveToPoint:
pathString += "M " + element.x + " " + element.y + " ";
break;
case kCGPathElementAddLineToPoint:
pathString += "L " + element.x + " " + element.y + " ";
break;
case kCGPathElementAddQuadCurveToPoint:
pathString += "Q " + element.cpx + " " + element.cpy + " " + element.x + " " + element.y + " ";
break;
case kCGPathElementAddCurveToPoint:
pathString += "C " + element.cp1x + " " + element.cp1y + " " + element.cp2x + " " + element.cp2y + " " + element.x + " " + element.y + " ";
break;
case kCGPathElementCloseSubpath:
pathString += "Z ";
break;
}
}
return pathString.trim();
}
,["CPString"])]);
}
p;7;CPBox.jt;45800;@STATIC;1.0;i;13;CPTextField.ji;8;CPView.jI;23;Foundation/CPGeometry.jt;45722;objj_executeFile("CPTextField.j", YES);objj_executeFile("CPView.j", YES);objj_executeFile("Foundation/CPGeometry.j", NO);{var the_typedef = objj_allocateTypeDef("CPBoxType");
objj_registerTypeDef(the_typedef);
}CPBoxPrimary = 0;
@@ -48116,9 +48150,16 @@ class_addMethods(the_class, [new objj_method(sel_getUid("init"), function $CABas
,["id"])]);
}
p;21;CAKeyframeAnimation.jt;1968;@STATIC;1.0;I;21;Foundation/CPObject.ji;21;CAPropertyAnimation.jt;1897;objj_executeFile("Foundation/CPObject.j", NO);objj_executeFile("CAPropertyAnimation.j", YES);
p;21;CAKeyframeAnimation.jt;4732;@STATIC;1.0;I;21;Foundation/CPObject.ji;21;CAPropertyAnimation.jt;4661;objj_executeFile("Foundation/CPObject.j", NO);objj_executeFile("CAPropertyAnimation.j", YES);kCAAnimationLinear = "linear";
kCAAnimationDiscrete = "discrete";
kCAAnimationPaced = "paced";
kCAAnimationCubic = "cubic";
kCAAnimationCubicPaced = "cubicPaced";
kCAAnimationRotateAuto = "auto";
kCAAnimationRotateAutoReverse = "autoReverse";
{var the_class = objj_allocateClassPair(CAPropertyAnimation, "CAKeyframeAnimation"),
meta_class = the_class.isa;class_addIvars(the_class, [new objj_ivar("_values", "CPArray"), new objj_ivar("_keyTimes", "CPArray"), new objj_ivar("_timingFunctions", "CPArray")]);objj_registerClassPair(the_class);
meta_class = the_class.isa;class_addIvars(the_class, [new objj_ivar("_values", "CPArray"), new objj_ivar("_keyTimes", "CPArray"), new objj_ivar("_timingFunctions", "CPArray"), new objj_ivar("_path", "id"), new objj_ivar("_calculationMode", "CPString"), new objj_ivar("_rotationMode", "CPString"), new objj_ivar("_tensionValues", "CPArray"), new objj_ivar("_continuityValues", "CPArray"), new objj_ivar("_biasValues", "CPArray")]);objj_registerClassPair(the_class);
class_addMethods(the_class, [new objj_method(sel_getUid("values"), function $CAKeyframeAnimation__values(self, _cmd)
{
return self._values;
@@ -48149,12 +48190,75 @@ class_addMethods(the_class, [new objj_method(sel_getUid("values"), function $CAK
self._timingFunctions = newValue;
}
,["void","CPArray"]), new objj_method(sel_getUid("path"), function $CAKeyframeAnimation__path(self, _cmd)
{
return self._path;
}
,["id"]), new objj_method(sel_getUid("setPath:"), function $CAKeyframeAnimation__setPath_(self, _cmd, newValue)
{
self._path = newValue;
}
,["void","id"]), new objj_method(sel_getUid("calculationMode"), function $CAKeyframeAnimation__calculationMode(self, _cmd)
{
return self._calculationMode;
}
,["CPString"]), new objj_method(sel_getUid("setCalculationMode:"), function $CAKeyframeAnimation__setCalculationMode_(self, _cmd, newValue)
{
self._calculationMode = newValue;
}
,["void","CPString"]), new objj_method(sel_getUid("rotationMode"), function $CAKeyframeAnimation__rotationMode(self, _cmd)
{
return self._rotationMode;
}
,["CPString"]), new objj_method(sel_getUid("setRotationMode:"), function $CAKeyframeAnimation__setRotationMode_(self, _cmd, newValue)
{
self._rotationMode = newValue;
}
,["void","CPString"]), new objj_method(sel_getUid("tensionValues"), function $CAKeyframeAnimation__tensionValues(self, _cmd)
{
return self._tensionValues;
}
,["CPArray"]), new objj_method(sel_getUid("setTensionValues:"), function $CAKeyframeAnimation__setTensionValues_(self, _cmd, newValue)
{
self._tensionValues = newValue;
}
,["void","CPArray"]), new objj_method(sel_getUid("continuityValues"), function $CAKeyframeAnimation__continuityValues(self, _cmd)
{
return self._continuityValues;
}
,["CPArray"]), new objj_method(sel_getUid("setContinuityValues:"), function $CAKeyframeAnimation__setContinuityValues_(self, _cmd, newValue)
{
self._continuityValues = newValue;
}
,["void","CPArray"]), new objj_method(sel_getUid("biasValues"), function $CAKeyframeAnimation__biasValues(self, _cmd)
{
return self._biasValues;
}
,["CPArray"]), new objj_method(sel_getUid("setBiasValues:"), function $CAKeyframeAnimation__setBiasValues_(self, _cmd, newValue)
{
self._biasValues = newValue;
}
,["void","CPArray"]), new objj_method(sel_getUid("init"), function $CAKeyframeAnimation__init(self, _cmd)
{
self = (objj_getClass("CAKeyframeAnimation").super_class.method_dtable["init"] || _objj_forward)(self, "init");
self._values = (CPArray.isa.method_msgSend["array"] || _objj_forward)(CPArray, "array");
self._keyTimes = (CPArray.isa.method_msgSend["array"] || _objj_forward)(CPArray, "array");
self._timingFunctions = (CPArray.isa.method_msgSend["array"] || _objj_forward)(CPArray, "array");
self._tensionValues = (CPArray.isa.method_msgSend["array"] || _objj_forward)(CPArray, "array");
self._continuityValues = (CPArray.isa.method_msgSend["array"] || _objj_forward)(CPArray, "array");
self._biasValues = (CPArray.isa.method_msgSend["array"] || _objj_forward)(CPArray, "array");
return self;
}
@@ -48911,7 +49015,7 @@ class_addMethods(meta_class, [new objj_method(sel_getUid("animationWithKeyPath:"
,["id","CPString"])]);
}
p;20;CPAnimationContext.jt;28637;@STATIC;1.0;i;18;CABasicAnimation.ji;21;CAKeyframeAnimation.ji;8;CPView.jI;20;Foundation/CPTimer.jI;22;Foundation/CPRunLoop.jt;28504;objj_executeFile("CABasicAnimation.j", YES);objj_executeFile("CAKeyframeAnimation.j", YES);objj_executeFile("CPView.j", YES);objj_executeFile("Foundation/CPTimer.j", NO);objj_executeFile("Foundation/CPRunLoop.j", NO);{var the_typedef = objj_allocateTypeDef("Map");
p;20;CPAnimationContext.jt;29938;@STATIC;1.0;i;18;CABasicAnimation.ji;21;CAKeyframeAnimation.ji;8;CPView.jI;20;Foundation/CPTimer.jI;22;Foundation/CPRunLoop.jt;29805;objj_executeFile("CABasicAnimation.j", YES);objj_executeFile("CAKeyframeAnimation.j", YES);objj_executeFile("CPView.j", YES);objj_executeFile("Foundation/CPTimer.j", NO);objj_executeFile("Foundation/CPRunLoop.j", NO);{var the_typedef = objj_allocateTypeDef("Map");
objj_registerTypeDef(the_typedef);
};
var _CPAnimationContextStack = nil,
@@ -48999,6 +49103,13 @@ class_addMethods(the_class, [new objj_method(sel_getUid("duration"), function $C
values = (animation == null ? animation : (animation.isa.method_msgSend["values"] || _objj_forward)(animation, "values"));
keyTimes = (animation == null ? animation : (animation.isa.method_msgSend["keyTimes"] || _objj_forward)(animation, "keyTimes"));
timingFunctions = (animation == null ? animation : (animation.isa.method_msgSend["timingFunctionsControlPoints"] || _objj_forward)(animation, "timingFunctionsControlPoints"));
var path = (animation == null ? animation : (animation.isa.method_msgSend["path"] || _objj_forward)(animation, "path"));
var calculationMode = (animation == null ? animation : (animation.isa.method_msgSend["calculationMode"] || _objj_forward)(animation, "calculationMode")) || kCAAnimationLinear;
var rotationMode = (animation == null ? animation : (animation.isa.method_msgSend["rotationMode"] || _objj_forward)(animation, "rotationMode"));
var tensionValues = (animation == null ? animation : (animation.isa.method_msgSend["tensionValues"] || _objj_forward)(animation, "tensionValues"));
var continuityValues = (animation == null ? animation : (animation.isa.method_msgSend["continuityValues"] || _objj_forward)(animation, "continuityValues"));
var biasValues = (animation == null ? animation : (animation.isa.method_msgSend["biasValues"] || _objj_forward)(animation, "biasValues"));
return {object: anObject, root: anObject, keypath: animatedKeyPath, duration: duration, completion: completionFunction, values: values, keytimes: keyTimes, timingfunctions: timingFunctions, path: path, calculationMode: calculationMode, rotationMode: rotationMode, tensionValues: tensionValues, continuityValues: continuityValues, biasValues: biasValues};
}
else
{
@@ -49012,8 +49123,8 @@ class_addMethods(the_class, [new objj_method(sel_getUid("duration"), function $C
values = [fromValue, toValue];
keyTimes = [0, 1];
timingFunctions = isBasicAnimation ? (animation == null ? animation : (animation.isa.method_msgSend["timingFunctionControlPoints"] || _objj_forward)(animation, "timingFunctionControlPoints")) : ((___r1 = self._timingFunction), ___r1 == null ? ___r1 : (___r1.isa.method_msgSend["controlPoints"] || _objj_forward)(___r1, "controlPoints"));
return {object: anObject, root: anObject, keypath: animatedKeyPath, values: values, keytimes: keyTimes, duration: duration, timingfunctions: timingFunctions, completion: completionFunction};
}
return {object: anObject, root: anObject, keypath: animatedKeyPath, values: values, keytimes: keyTimes, duration: duration, timingfunctions: timingFunctions, completion: completionFunction};
var ___r1;
}
@@ -49364,7 +49475,7 @@ var _animationFlushingObserverCallback = function()
_animationFlushingObserver = nil;
}
};
p;16;CPViewAnimator.jt;24191;@STATIC;1.0;i;19;_CPObjectAnimator.ji;8;CPView.ji;17;CPCompatibility.ji;14;CSSAnimation.jt;24094;objj_executeFile("_CPObjectAnimator.j", YES);objj_executeFile("CPView.j", YES);objj_executeFile("CPCompatibility.j", YES);objj_executeFile("CSSAnimation.j", YES);var DEFAULT_CSS_PROPERTIES = nil,
p;16;CPViewAnimator.jt;27630;@STATIC;1.0;i;19;_CPObjectAnimator.ji;8;CPView.ji;17;CPCompatibility.ji;14;CSSAnimation.jt;27533;objj_executeFile("_CPObjectAnimator.j", YES);objj_executeFile("CPView.j", YES);objj_executeFile("CPCompatibility.j", YES);objj_executeFile("CSSAnimation.j", YES);var DEFAULT_CSS_PROPERTIES = nil,
FRAME_UPDATERS = {};
{var the_class = objj_allocateClassPair(_CPObjectAnimator, "CPViewAnimator"),
@@ -49478,6 +49589,10 @@ class_addMethods(meta_class, [new objj_method(sel_getUid("_defaultCSSProperties"
,["CPDictionary"]), new objj_method(sel_getUid("addAnimations:forAction:"), function $CPViewAnimator__addAnimations_forAction_(self, _cmd, animations, anAction)
{
var target = anAction.object;
if (anAction.path)
{
return (self.isa.method_msgSend["_addPathAnimation:forAction:domElement:identifier:"] || _objj_forward)(self, "_addPathAnimation:forAction:domElement:identifier:", animations, anAction, (target == null ? target : (target.isa.method_msgSend["_DOMElement"] || _objj_forward)(target, "_DOMElement")), (target == null ? target : (target.isa.method_msgSend["UID"] || _objj_forward)(target, "UID")));
}
return (self.isa.method_msgSend["_addAnimations:forAction:domElement:identifier:"] || _objj_forward)(self, "_addAnimations:forAction:domElement:identifier:", animations, anAction, (target == null ? target : (target.isa.method_msgSend["_DOMElement"] || _objj_forward)(target, "_DOMElement")), (target == null ? target : (target.isa.method_msgSend["UID"] || _objj_forward)(target, "UID")));
}
@@ -49492,17 +49607,88 @@ class_addMethods(meta_class, [new objj_method(sel_getUid("_defaultCSSProperties"
animation = new CSSAnimation(aDomElement, anIdentifier, ((___r1 = anAction.object), ___r1 == null ? ___r1 : (___r1.isa.method_msgSend["debug_description"] || _objj_forward)(___r1, "debug_description")));
(animations == null ? animations : (animations.isa.method_msgSend["addObject:"] || _objj_forward)(animations, "addObject:", animation));
}
var calculationMode = anAction.calculationMode;
var timingFunctions = anAction.timingfunctions;
if (calculationMode === kCAAnimationDiscrete)
{
timingFunctions = "steps(1, end)";
}
var css_mapping = (self.isa.method_msgSend["_cssPropertiesForKeyPath:"] || _objj_forward)(self, "_cssPropertiesForKeyPath:", anAction.keypath);
(css_mapping == null ? css_mapping : (css_mapping.isa.method_msgSend["enumerateObjectsUsingBlock:"] || _objj_forward)(css_mapping, "enumerateObjectsUsingBlock:", function(aDict, anIndex, stop)
{
var completionFunction = anIndex == 0 ? anAction.completion : null,
property = (aDict == null ? aDict : (aDict.isa.method_msgSend["objectForKey:"] || _objj_forward)(aDict, "objectForKey:", "property")),
getter = (aDict == null ? aDict : (aDict.isa.method_msgSend["objectForKey:"] || _objj_forward)(aDict, "objectForKey:", "value"));
animation.addPropertyAnimation(property, getter, anAction.duration, anAction.keytimes, anAction.values, anAction.timingfunctions, completionFunction);
animation.addPropertyAnimation(property, getter, anAction.duration, anAction.keytimes, anAction.values, timingFunctions, completionFunction);
}));
var ___r1;
}
,["void","CPArray","id","Object","CPString"]), new objj_method(sel_getUid("_addPathAnimation:forAction:domElement:identifier:"), function $CPViewAnimator___addPathAnimation_forAction_domElement_identifier_(self, _cmd, animations, anAction, aDomElement, anIdentifier)
{
var animation = (animations == null ? animations : (animations.isa.method_msgSend["objectPassingTest:"] || _objj_forward)(animations, "objectPassingTest:", function(anim, idx, stop)
{
return anim.identifier == anIdentifier;
}));
if (animation == nil)
{
animation = new CSSAnimation(aDomElement, anIdentifier, ((___r1 = anAction.object), ___r1 == null ? ___r1 : (___r1.isa.method_msgSend["debug_description"] || _objj_forward)(___r1, "debug_description")));
(animations == null ? animations : (animations.isa.method_msgSend["addObject:"] || _objj_forward)(animations, "addObject:", animation));
}
var svgPath = ((___r1 = anAction.path), ___r1 == null ? ___r1 : (___r1.isa.method_msgSend["SVGString"] || _objj_forward)(___r1, "SVGString"));
aDomElement.style.offsetPath = "path('" + svgPath + "')";
if (anAction.keypath === "frameOrigin")
{
aDomElement.style.offsetAnchor = "0% 0%";
aDomElement.style.left = "0px";
aDomElement.style.top = "0px";
}
else
{
aDomElement.style.offsetAnchor = "50% 50%";
}
var rotationMode = anAction.rotationMode;
if (rotationMode === kCAAnimationRotateAuto)
{
aDomElement.style.offsetRotate = "auto";
}
else if (rotationMode === kCAAnimationRotateAutoReverse)
{
aDomElement.style.offsetRotate = "auto reverse";
}
else
{
aDomElement.style.offsetRotate = "0deg";
}
var originalCompletion = anAction.completion;
var cleanupCompletion = function()
{
if (originalCompletion)
originalCompletion();
aDomElement.style.offsetPath = null;
aDomElement.style.offsetAnchor = null;
aDomElement.style.offsetRotate = null;
};
var getter = function(start, current)
{
return current;
};
var values = ["0%", "100%"];
var keytimes = [0, 1];
var timingfunctions;
if (anAction.calculationMode === kCAAnimationPaced)
{
timingfunctions = "linear";
}
else
{
timingfunctions = ((___r1 = (CPAnimationContext.isa.method_msgSend["currentContext"] || _objj_forward)(CPAnimationContext, "currentContext")), ___r1 == null ? ___r1 : (___r1.isa.method_msgSend["timingFunction"] || _objj_forward)(___r1, "timingFunction"));
}
animation.addPropertyAnimation("offset-distance", getter, anAction.duration, keytimes, values, timingfunctions, cleanupCompletion);
animation.setFillMode("forwards");
var ___r1;
}
,["void","CPArray","id","Object","CPString"]), new objj_method(sel_getUid("_cssPropertiesForKeyPath:"), function $CPViewAnimator___cssPropertiesForKeyPath_(self, _cmd, aKeyPath)
{
return ((___r1 = (self.isa.method_msgSend["_defaultCSSProperties"] || _objj_forward)(self, "_defaultCSSProperties")), ___r1 == null ? ___r1 : (___r1.isa.method_msgSend["objectForKey:"] || _objj_forward)(___r1, "objectForKey:", aKeyPath));
@@ -49754,7 +49940,7 @@ var createUpdateFrame = function(aView, aKeyPath)
};
return updateFrame;
};
p;14;CSSAnimation.jt;8703;@STATIC;1.0;t;8684;var ANIMATIONS_GLOBAL_ID = 0,
p;14;CSSAnimation.jt;8841;@STATIC;1.0;t;8822;var ANIMATIONS_GLOBAL_ID = 0,
CURRENT_ANIMATIONS = {},
ANIMATION_END_EVENT_NAME,
ANIMATION_PROPERTY,
@@ -49979,6 +50165,10 @@ CSSAnimation.prototype.start = function()
this.islive = true;
return true;
};
CSSAnimation.prototype.setFillMode = function(aProperty)
{
this.target.style.setProperty(ANIMATION_FILL_MODE_PROPERTY, aProperty);
};
p;19;CGAffineTransform.jt;5247;@STATIC;1.0;i;12;CGGeometry.jt;5211;objj_executeFile("CGGeometry.j", YES);{var the_typedef = objj_allocateTypeDef("CGAffineTransform");
objj_registerTypeDef(the_typedef);
}CGAffineTransformMake = function(a, b, c, d, tx, ty)
+272 -53
View File
@@ -8,12 +8,45 @@
@import <Foundation/Foundation.j>
@import <AppKit/AppKit.j>
@import <AppKit/CAKeyframeAnimation.j>
#define UIAssert(a) [self markTest:_cmd didPass:a];
// A new custom view class to draw the animation path.
@implementation PathView : CPView
{
CPBezierPath _path;
}
- (void)setPath:(CPBezierPath)aPath
{
_path = aPath;
[self setNeedsDisplay:YES];
}
- (void)drawRect:(CGRect)aRect
{
if (_path)
{
[[CPColor lightGrayColor] set];
[_path setLineWidth:2.0];
// Use a dashed line to make it clearer it's a guide
var dashes = [2, 3];
[_path setLineDash:dashes count:2 phase:0];
[_path stroke];
}
}
@end
@implementation AppController : CPObject
{
CPWindow theWindow;
CPView _testView; // A view to animate for our new tests
PathView _pathView; // A view to draw the animation path
CGRect _initialTestViewFrame;
id allLabels; // An array of labels to show test results
}
- (void)applicationDidFinishLaunching:(CPNotification)aNotification
@@ -23,41 +56,91 @@
[theWindow orderFront:self];
// Create a view to draw the intended animation path.
_pathView = [[PathView alloc] initWithFrame:[contentView bounds]];
[_pathView setAutoresizingMask:CPViewWidthSizable | CPViewHeightSizable];
[contentView addSubview:_pathView];
// Create a view that we can animate for the new tests.
_initialTestViewFrame = CGRectMake(390, 450, 50, 50);
_testView = [[CPView alloc] initWithFrame:_initialTestViewFrame];
[_testView setBackgroundColor:[CPColor blueColor]];
[contentView addSubview:_testView]; // Add it on top of the path view
// [_pathView setFrameOrigin:_initialTestViewFrame.origin];
[self setup];
// Uncomment the following line to turn on the standard menu bar.
//[CPMenu setMenuBarVisible:YES];
}
- (void)cleanupAfterAnimation
{
[_pathView setPath:nil];
// Animate the test view back to its starting position.
var animation = [[CPViewAnimation alloc] initWithViewAnimations:[@{
CPViewAnimationTargetKey:_testView,
CPViewAnimationStartFrameKey:[_testView frame],
CPViewAnimationEndFrameKey:_initialTestViewFrame
}]];
[animation setAnimationCurve:CPAnimationLinear];
[animation setDuration:0.1];
[animation startAnimation];
}
- (void)setup
{
var methods = class_copyMethodList([self class]);
var testMethodCount = 0;
allLabels = [];
[methods enumerateObjectsUsingBlock:function(meth, _)
{
{
var method_name = method_getName(meth);
if ([method_name hasPrefix:@"test"])
{
var runButton = [[CPButton alloc] initWithFrame:CGRectMake(10,10 + 35*testMethodCount,0,32)];
var yPos = 10 + 35 * testMethodCount;
var runButton = [[CPButton alloc] initWithFrame:CGRectMake(10, yPos, 0, 32)];
[runButton setTitle:unCamelCase(method_name)];
[runButton setTarget:self];
[runButton setAction:CPSelectorFromString(method_name)];
[[theWindow contentView] addSubview:runButton];
[runButton sizeToFit];
var label = [[CPTextField alloc] initWithFrame:CGRectMake(CGRectGetMaxX([runButton frame]) + 10, 10 + 35*testMethodCount,200,32)];
var label = [[CPTextField alloc] initWithFrame:CGRectMake(CGRectGetMaxX([runButton frame]) + 10, yPos, 200, 32)];
[label setIdentifier:method_name];
[label setFont:[CPFont systemFontOfSize:16]];
[label setStringValue:@"………"];
[[theWindow contentView] addSubview:label];
[allLabels addObject:label];
testMethodCount++;
}
}];
// Add a reset button that clears the view and labels
var resetButton = [[CPButton alloc] initWithFrame:CGRectMake(10, 10 + 35 * testMethodCount, 0, 32)];
[resetButton setTitle:@"Reset"];
[resetButton setTarget:self];
[resetButton setAction:@selector(reset:)];
[[theWindow contentView] addSubview:resetButton];
[resetButton sizeToFit];
}
- (void)reset:(id)sender
{
[_testView setFrame:_initialTestViewFrame];
[_pathView setPath:nil];
[allLabels enumerateObjectsUsingBlock:function(label) {
[label setTextColor:[CPColor blackColor]];
[label setStringValue:@"………"];
}];
}
- (void)markTest:(CPString)testSelector didPass:(BOOL)passed
{
[[[theWindow contentView] subviews] enumerateObjectsUsingBlock:function(aView, idx, stop)
{
{
if ([aView identifier] == testSelector)
{
[aView setTextColor:passed ? [CPColor greenColor]: [CPColor redColor]];
@@ -66,39 +149,173 @@
}];
}
/*
===================
====== TESTS ======
===================
*/
- (void)testPathAnimation:(id)sender
{
[_testView setFrame:_initialTestViewFrame];
// 1. Define the desired trajectory for the view's ORIGIN.
var startOrigin = _initialTestViewFrame.origin;
var endOrigin = CGPointMake(startOrigin.x + 200, startOrigin.y - 300);
var control1Origin = CGPointMake(startOrigin.x - 100, startOrigin.y);
var control2Origin = CGPointMake(endOrigin.x + 100, endOrigin.y + 100);
// 2. Calculate the path for the view's CENTER. This path is used for BOTH
// the visual guide and the animation data.
var offsetX = _initialTestViewFrame.size.width / 2.0;
var offsetY = _initialTestViewFrame.size.height / 2.0;
var startCenter = CGPointMake(startOrigin.x + offsetX, startOrigin.y + offsetY);
var endCenter = CGPointMake(endOrigin.x + offsetX, endOrigin.y + offsetY);
var control1Center = CGPointMake(control1Origin.x + offsetX, control1Origin.y + offsetY);
var control2Center = CGPointMake(control2Origin.x + offsetX, control2Origin.y + offsetY);
var centerPath = [CPBezierPath bezierPath];
[centerPath moveToPoint:startCenter];
[centerPath curveToPoint:endCenter
controlPoint1:control1Center
controlPoint2:control2Center];
// 3. Set the visual guide and the animation path.
[_pathView setPath:centerPath];
var pathAnimation = [CAKeyframeAnimation animationWithKeyPath:@"frameOrigin"];
[pathAnimation setPath:centerPath]; // The system uses this path for the CENTER.
[pathAnimation setDuration:2.0];
[pathAnimation setCalculationMode:kCAAnimationPaced];
[pathAnimation setRotationMode:kCAAnimationRotateAuto];
[CPAnimationContext beginGrouping];
var context = [CPAnimationContext currentContext];
[context setDuration:2.0];
[context setCompletionHandler:function()
{
var finalOrigin = [_testView frame].origin;
var passed = (Math.abs(finalOrigin.x - endOrigin.x) < 1 && Math.abs(finalOrigin.y - endOrigin.y) < 1);
[self markTest:_cmd didPass:passed];
[self performSelector:@selector(cleanupAfterAnimation) withObject:nil afterDelay:0.5];
}];
// 4. Associate the animation with 'frameOrigin' and trigger it with 'setFrameOrigin:'.
[_testView setAnimations:[CPDictionary dictionaryWithObject:pathAnimation forKey:@"frameOrigin"]];
[[_testView animator] setFrameOrigin:endOrigin];
[CPAnimationContext endGrouping];
}
- (void)testDiscreteAnimation:(id)sender
{
[_testView setFrame:_initialTestViewFrame];
// 1. Define origin points.
var p1Origin = _initialTestViewFrame.origin;
var p2Origin = CGPointMake(p1Origin.x + 100, p1Origin.y);
var p3Origin = CGPointMake(p1Origin.x + 100, p1Origin.y - 100);
var endOrigin = CGPointMake(p1Origin.x, p1Origin.y - 100);
// 2. Create the visual guide based on the center.
var offsetX = _initialTestViewFrame.size.width / 2.0;
var offsetY = _initialTestViewFrame.size.height / 2.0;
var visualPath = [CPBezierPath bezierPath];
[visualPath moveToPoint:CGPointMake(p1Origin.x + offsetX, p1Origin.y + offsetY)];
[visualPath lineToPoint:CGPointMake(p2Origin.x + offsetX, p2Origin.y + offsetY)];
[visualPath lineToPoint:CGPointMake(p3Origin.x + offsetX, p3Origin.y + offsetY)];
[visualPath lineToPoint:CGPointMake(endOrigin.x + offsetX, endOrigin.y + offsetY)];
// [_pathView setFrameOrigin:_initialTestViewFrame.origin];
[_pathView setPath:visualPath];
// 3. The animation uses the origin values directly.
var discreteAnimation = [CAKeyframeAnimation animationWithKeyPath:@"frameOrigin"];
[discreteAnimation setValues:[p1Origin, p2Origin, p3Origin, endOrigin]];
[discreteAnimation setKeyTimes:[0, 0.33, 0.66, 1.0]];
[discreteAnimation setCalculationMode:kCAAnimationDiscrete];
[CPAnimationContext beginGrouping];
var context = [CPAnimationContext currentContext];
[context setDuration:2.0];
[context setCompletionHandler:function()
{
var finalOrigin = [_testView frame].origin;
var passed = (Math.abs(finalOrigin.x - endOrigin.x) < 1 && Math.abs(finalOrigin.y - endOrigin.y) < 1);
[self markTest:_cmd didPass:passed];
[self performSelector:@selector(cleanupAfterAnimation) withObject:nil afterDelay:0.5];
}];
[_testView setAnimations:[CPDictionary dictionaryWithObject:discreteAnimation forKey:@"frameOrigin"]];
[[_testView animator] setFrameOrigin:endOrigin];
[CPAnimationContext endGrouping];
}
- (void)testPathAnimationWithAutoReverseRotation:(id)sender
{
[_testView setFrame:_initialTestViewFrame];
// 1. Define origin trajectory.
var startOrigin = _initialTestViewFrame.origin;
var endOrigin = CGPointMake(startOrigin.x + 300, startOrigin.y - 150);
// 2. Calculate the corresponding center trajectory.
var offsetX = _initialTestViewFrame.size.width / 2.0;
var offsetY = _initialTestViewFrame.size.height / 2.0;
var startCenter = CGPointMake(startOrigin.x + offsetX, startOrigin.y + offsetY);
var endCenter = CGPointMake(endOrigin.x + offsetX, endOrigin.y + offsetY);
var centerPath = [CPBezierPath bezierPath];
[centerPath moveToPoint:startCenter];
[centerPath lineToPoint:endCenter];
// 3. Use the center path for the guide and the animation data.
[_pathView setPath:centerPath];
var pathAnimation = [CAKeyframeAnimation animationWithKeyPath:@"frameOrigin"];
[pathAnimation setPath:centerPath];
[pathAnimation setRotationMode:kCAAnimationRotateAutoReverse];
[CPAnimationContext beginGrouping];
var context = [CPAnimationContext currentContext];
[context setDuration:2.0];
[context setCompletionHandler:function()
{
var finalOrigin = [_testView frame].origin;
var passed = (Math.abs(finalOrigin.x - endOrigin.x) < 1 && Math.abs(finalOrigin.y - endOrigin.y) < 1);
[self markTest:_cmd didPass:passed];
[self performSelector:@selector(cleanupAfterAnimation) withObject:nil afterDelay:0.5];
}];
// 4. Trigger by setting the final origin.
[_testView setAnimations:[CPDictionary dictionaryWithObject:pathAnimation forKey:@"frameOrigin"]];
[[_testView animator] setFrameOrigin:endOrigin];
[CPAnimationContext endGrouping];
}
- (void)testCompletionHandlerWithoutAnimator
{
var completions = @[];
var ctx = [CPAnimationContext currentContext];
[ctx setDuration:0.1];
[ctx setCompletionHandler:function()
{
[CPAnimationContext beginGrouping];
var context = [CPAnimationContext currentContext];
[context setDuration:0.01];
[context setCompletionHandler:function()
{
[completions addObject:@"done"];
UIAssert([completions isEqualToArray:@["done"]]);
}];
[CPAnimationContext endGrouping];
}
- (void)testCompletionHandlerWithoutAnimatorWithGrouping
{
var completions = @[];
var ctx = [CPAnimationContext currentContext];
[ctx setDuration:0.1];
[CPAnimationContext beginGrouping];
[ctx setCompletionHandler:function()
{
var context = [CPAnimationContext currentContext];
[context setDuration:0.01];
[context setCompletionHandler:function()
{
[completions addObject:@"done"];
UIAssert([completions isEqualToArray:@["done"]]);
}];
[CPAnimationContext endGrouping];
}
@@ -106,21 +323,24 @@
{
var completions = @[];
var ctx = [CPAnimationContext currentContext];
[ctx setDuration:0.1];
[ctx setCompletionHandler:function()
{
// This test relies on the auto-flushing behavior of the runloop for a single-level context.
// The reference shows that if the stack count is 1, the observer will flush it.
// However, to make it a reliable, self-contained test, we manually group and end.
// The original test's logic about inheritance is tested this way: the outer group's
// completion handler should fire, but the inner group (which inherits duration but not the handler) should not.
[CPAnimationContext beginGrouping];
var outerContext = [CPAnimationContext currentContext];
[outerContext setDuration:0.01];
[outerContext setCompletionHandler:function()
{
[completions addObject:@"done"];
UIAssert([completions isEqualToArray:@["done"]]);
}];
// Cocoa : When grouping begins, the grouping context inherits
// the duration & timingFunction properties from the current context
// but NOT the completionHandler.
// In this test, the completion handler should be performed once as part
// of the current context (with no animations) but not as part of the
// grouping context.
// Inner group
[CPAnimationContext beginGrouping];
[CPAnimationContext endGrouping];
[CPAnimationContext endGrouping];
}
@@ -130,17 +350,15 @@
var completions = @[];
[CPAnimationContext beginGrouping];
var ctx = [CPAnimationContext currentContext];
[ctx setDuration:0.1];
[ctx setCompletionHandler:function()
{
var context = [CPAnimationContext currentContext];
[context setDuration:0.01];
[context setCompletionHandler:function()
{
[completions addObject:@"done"];
UIAssert([completions isEqualToArray:@["done"]]);
}];
[[sender animator] setObjectValue:0];
[[sender animator] setObjectValue:[sender objectValue]];
[CPAnimationContext endGrouping];
}
@@ -149,17 +367,15 @@
var completions = @[];
[CPAnimationContext beginGrouping];
var ctx = [CPAnimationContext currentContext];
[ctx setDuration:0.1];
[ctx setCompletionHandler:function()
{
var context = [CPAnimationContext currentContext];
[context setDuration:0.01];
[context setCompletionHandler:function()
{
[completions addObject:@"done"];
UIAssert([completions isEqualToArray:@["done"]]);
}];
[[sender animator] setFrame:[sender frame]];
[CPAnimationContext endGrouping];
}
@@ -167,29 +383,32 @@
{
var completions = @[];
var ctx = [CPAnimationContext currentContext];
[ctx setDuration:0.1];
[ctx setCompletionHandler:function()
{
CPLog.debug("We should never be here");
[CPAnimationContext beginGrouping];
var context = [CPAnimationContext currentContext];
[context setDuration:0.01];
[context setCompletionHandler:function()
{
// This handler should be replaced and never called.
UIAssert(NO);
}];
[ctx setCompletionHandler:function()
{
// Set the handler again, which should replace the first one.
[context setCompletionHandler:function()
{
[completions addObject:@"done"];
UIAssert([completions isEqualToArray:@["done"]]);
}];
[[sender animator] setFrame:[sender frame]];
[CPAnimationContext endGrouping];
}
@end
var unCamelCase = function(aString)
{
// insert a space before all caps
// insert a space before all caps
return aString.replace(/([A-Z])/g, ' $1')
// uppercase the first character
// uppercase the first character
.replace(/^./, function(str){ return str.toUpperCase(); });
};
+142 -142
View File
@@ -1,142 +1,142 @@
1763576247132|ArrayController1|
1763576247146|ArrayControllerInitialSelectionTest|
1763576247159|ArrayControllerRemovingFirstTest|
1763576247173|AttachedSheet|
1763576247186|AttachedSheet2|
1763576247200|Bindings|
1763576247213|CGCanvasContext|
1763576247227|CGPath|
1763576247240|CPAlertTest|
1763576247253|CPAnimatablePropertyContainerTest|
1763576247267|CPAnimationContextTest|
1763576247280|CPAnimationTest|
1763576247293|CPBinder-echo-bug|
1763576247307|CPBoxCibTest|
1763576247321|CPBoxTest|
1763576247335|CPBrowserTest|
1763576247349|CPButtonKeyEquivalentDefaultTest|
1763576247362|CPButtonTest|
1763576247376|CPByteCountFormatter|
1763576247390|CPCollectionViewNibTest|
1763576247403|CPColor-CPImage-description|
1763576247416|CPColorWellBindings|
1763576247430|CPComboBoxTest|
1763576247443|CPControlPerformClickExceptionTest|
1763576247456|CPControlSize|
1763576247470|CPCursor|
1763576247483|CPDateFormatterTest|
1763576247496|CPDatePickerTest|
1763576247510|CPDictionaryControllerTest|
1763576247523|CPDocumentControllerTest|
1763576247537|CPFormatterTest|
1763576247550|CPGraphicsTest|
1763576247563|CPImageAndTextViewImageScaling|
1763576247577|CPImageViewAlignmentScaling|
1763576247590|CPImageViewTest|
1763576247603|CPImageViewbindingsTest|
1763576247617|CPLevelIndicator|
1763576247630|CPLocalizationTest|
1763576247643|CPLogTest|
1763576247657|CPMenuCALayerTest|
1763576247670|CPMenuEnabledBindingsTest|
1763576247684|CPMenuKeyEquivalents|
1763576247697|CPMenuRemoveAllTest|
1763576247710|CPMenuSubmenuPlacementConstraints|
1763576247724|CPMenuTest|
1763576247737|CPOutlineViewCibTest|
1763576247750|CPOutlineViewTest|
1763576247764|CPOutlineViewViewBasedCibTest|
1763576247777|CPPanelTest|
1763576247791|CPPlatformWindow|
1763576247804|CPPlattformWindowMinSize|
1763576247818|CPPopUpButtonBindings|
1763576247831|CPPopUpButtonTest|
1763576247844|CPPopover|
1763576247858|CPPredicateEditorCibTest|
1763576247871|CPProgressIndicator|
1763576247885|CPPropertyListSerializationTest|
1763576247898|CPRadioBindings|
1763576247912|CPRuleEditorCibTest|
1763576247925|CPScrollView|
1763576247938|CPScrollView2|
1763576247952|CPSearchField|
1763576247965|CPSearchFieldPredicateBinding|
1763576247979|CPSegmentedControlBindings|
1763576247992|CPSegmentedControlTest|
1763576248006|CPSoundTest|
1763576248019|CPSplitViewDivider|
1763576248032|CPSplitViewTest|
1763576248046|CPStepperBindings|
1763576248059|CPStepperNibTest|
1763576248073|CPTabView2|
1763576248086|CPTabViewBindings|
1763576248099|CPTabViewNib|
1763576248113|CPTableViewGroupRows|
1763576248126|CPTextField|
1763576248140|CPTextFieldEditingStyleTest|
1763576248153|CPTextFieldHeightTest|
1763576248166|CPTextFieldMovementsTest|
1763576248180|CPTextFieldMultiline|
1763576248193|CPTextView|
1763576248206|CPTextViewCibTest|
1763576248220|CPTextViewDelegateAndNotifications|
1763576248233|CPTimeZone|
1763576248246|CPTokenFieldTest|
1763576248260|CPToolTip|
1763576248273|CPToolbarTest|
1763576248286|CPURLConnectionAsyncTest|
1763576248300|CPURLConnectionSynchronousTest|
1763576248313|CPUserDefaults|
1763576248327|CPUserDefaultsControllerTest|
1763576248340|CPUserNotificationTest|
1763576248354|CPViewController|
1763576248367|CPVisualEffectViewTest|
1763576248380|CPWebViewTest|
1763576248394|CPWebViewTest2|
1763576248407|CPWindowLiveResizeTest|
1763576248420|CPWindowMovableTest|
1763576248434|CPWindowResizeStyle|
1763576248447|ChildWindows|
1763576248461|CompilationTests|
1763576248474|ContinuouslyUpdatesValueBinding|
1763576248487|CopyAndPaste|
1763576248501|CrossOriginTest|
1763576248514|FF4096Test|
1763576248528|FontEnhancementTest|
1763576248541|FontMetricsExplorer|
1763576248554|KeyEquivalents|
1763576248568|KeyViewLoopTest|
1763576248581|KeyWindowInTheBackgroundActivation|
1763576248595|LayoutTest|
1763576248608|LoadTimeTest|
1763576248622|LongBindings|
1763576248635|MobileTest|
1763576248648|MultipleValueBindings|
1763576248662|NSBoxTest|
1763576248675|NSBrowserTest|
1763576248688|NewTextFieldBezel|
1763576248702|Nib2CibAlignment|
1763576248715|Nib2CibBaselineAlignementTest|
1763576248728|Nib2CibSubviewsOrderTest|
1763576248742|NibAppRemixed|
1763576248755|PatternFillTest|
1763576248769|PlatformWindows|
1763576248782|PopUpButtonEscTest|
1763576248795|ScalingTest|
1763576248809|ScalingTest2|
1763576248822|ScrollviewTheming|
1763576248836|SheetWindowOrderFrontIssue|
1763576248849|SimpleBindings2|
1763576248862|SmartFoldersDemo|
1763576248876|TableTest|
1763576248889|ThemeBrowser|
1763576248903|ThemeKitchenSink|
1763576248916|TrackingArea|
1763576248930|UndoRedoWithMenuUpdate|
1763576248943|UserlandNSTest|
1763576248956|layoutEphemeralSubviewTest|
1763576248970|loadDynamicFrameworks|
1763576248983|performKeyEquivalentTest|
1763576248996|predicateWithFormat|
1763576249010|resignFirstResponder-CPControlTextDidEndEditing|
1763576249023|sizeToFitFix|
1763576343289|ArrayController1|
1763576343303|ArrayControllerInitialSelectionTest|
1763576343317|ArrayControllerRemovingFirstTest|
1763576343330|AttachedSheet|
1763576343344|AttachedSheet2|
1763576343357|Bindings|
1763576343371|CGCanvasContext|
1763576343384|CGPath|
1763576343397|CPAlertTest|
1763576343411|CPAnimatablePropertyContainerTest|
1763576343424|CPAnimationContextTest|
1763576343438|CPAnimationTest|
1763576343451|CPBinder-echo-bug|
1763576343465|CPBoxCibTest|
1763576343478|CPBoxTest|
1763576343491|CPBrowserTest|
1763576343505|CPButtonKeyEquivalentDefaultTest|
1763576343518|CPButtonTest|
1763576343532|CPByteCountFormatter|
1763576343545|CPCollectionViewNibTest|
1763576343558|CPColor-CPImage-description|
1763576343572|CPColorWellBindings|
1763576343585|CPComboBoxTest|
1763576343599|CPControlPerformClickExceptionTest|
1763576343612|CPControlSize|
1763576343625|CPCursor|
1763576343638|CPDateFormatterTest|
1763576343652|CPDatePickerTest|
1763576343665|CPDictionaryControllerTest|
1763576343679|CPDocumentControllerTest|
1763576343692|CPFormatterTest|
1763576343705|CPGraphicsTest|
1763576343718|CPImageAndTextViewImageScaling|
1763576343732|CPImageViewAlignmentScaling|
1763576343745|CPImageViewTest|
1763576343759|CPImageViewbindingsTest|
1763576343772|CPLevelIndicator|
1763576343786|CPLocalizationTest|
1763576343799|CPLogTest|
1763576343812|CPMenuCALayerTest|
1763576343826|CPMenuEnabledBindingsTest|
1763576343839|CPMenuKeyEquivalents|
1763576343853|CPMenuRemoveAllTest|
1763576343866|CPMenuSubmenuPlacementConstraints|
1763576343879|CPMenuTest|
1763576343893|CPOutlineViewCibTest|
1763576343907|CPOutlineViewTest|
1763576343920|CPOutlineViewViewBasedCibTest|
1763576343933|CPPanelTest|
1763576343947|CPPlatformWindow|
1763576343960|CPPlattformWindowMinSize|
1763576343973|CPPopUpButtonBindings|
1763576343987|CPPopUpButtonTest|
1763576344000|CPPopover|
1763576344013|CPPredicateEditorCibTest|
1763576344026|CPProgressIndicator|
1763576344040|CPPropertyListSerializationTest|
1763576344053|CPRadioBindings|
1763576344066|CPRuleEditorCibTest|
1763576344080|CPScrollView|
1763576344093|CPScrollView2|
1763576344106|CPSearchField|
1763576344119|CPSearchFieldPredicateBinding|
1763576344132|CPSegmentedControlBindings|
1763576344145|CPSegmentedControlTest|
1763576344159|CPSoundTest|
1763576344172|CPSplitViewDivider|
1763576344185|CPSplitViewTest|
1763576344198|CPStepperBindings|
1763576344211|CPStepperNibTest|
1763576344225|CPTabView2|
1763576344238|CPTabViewBindings|
1763576344251|CPTabViewNib|
1763576344264|CPTableViewGroupRows|
1763576344278|CPTextField|
1763576344291|CPTextFieldEditingStyleTest|
1763576344304|CPTextFieldHeightTest|
1763576344318|CPTextFieldMovementsTest|
1763576344331|CPTextFieldMultiline|
1763576344344|CPTextView|
1763576344357|CPTextViewCibTest|
1763576344371|CPTextViewDelegateAndNotifications|
1763576344384|CPTimeZone|
1763576344397|CPTokenFieldTest|
1763576344411|CPToolTip|
1763576344424|CPToolbarTest|
1763576344437|CPURLConnectionAsyncTest|
1763576344450|CPURLConnectionSynchronousTest|
1763576344464|CPUserDefaults|
1763576344477|CPUserDefaultsControllerTest|
1763576344491|CPUserNotificationTest|
1763576344504|CPViewController|
1763576344518|CPVisualEffectViewTest|
1763576344531|CPWebViewTest|
1763576344544|CPWebViewTest2|
1763576344558|CPWindowLiveResizeTest|
1763576344571|CPWindowMovableTest|
1763576344584|CPWindowResizeStyle|
1763576344598|ChildWindows|
1763576344611|CompilationTests|
1763576344624|ContinuouslyUpdatesValueBinding|
1763576344638|CopyAndPaste|
1763576344651|CrossOriginTest|
1763576344664|FF4096Test|
1763576344677|FontEnhancementTest|
1763576344691|FontMetricsExplorer|
1763576344704|KeyEquivalents|
1763576344717|KeyViewLoopTest|
1763576344731|KeyWindowInTheBackgroundActivation|
1763576344744|LayoutTest|
1763576344757|LoadTimeTest|
1763576344770|LongBindings|
1763576344783|MobileTest|
1763576344796|MultipleValueBindings|
1763576344810|NSBoxTest|
1763576344823|NSBrowserTest|
1763576344836|NewTextFieldBezel|
1763576344849|Nib2CibAlignment|
1763576344863|Nib2CibBaselineAlignementTest|
1763576344876|Nib2CibSubviewsOrderTest|
1763576344889|NibAppRemixed|
1763576344902|PatternFillTest|
1763576344915|PlatformWindows|
1763576344928|PopUpButtonEscTest|
1763576344941|ScalingTest|
1763576344955|ScalingTest2|
1763576344968|ScrollviewTheming|
1763576344981|SheetWindowOrderFrontIssue|
1763576344995|SimpleBindings2|
1763576345008|SmartFoldersDemo|
1763576345021|TableTest|
1763576345034|ThemeBrowser|
1763576345048|ThemeKitchenSink|
1763576345061|TrackingArea|
1763576345074|UndoRedoWithMenuUpdate|
1763576345087|UserlandNSTest|
1763576345101|layoutEphemeralSubviewTest|
1763576345114|loadDynamicFrameworks|
1763576345127|performKeyEquivalentTest|
1763576345140|predicateWithFormat|
1763576345154|resignFirstResponder-CPControlTextDidEndEditing|
1763576345167|sizeToFitFix|