Temp.
This commit is contained in:
Rossen Hristov
2015-07-30 10:58:45 +03:00
parent 8b32ed0176
commit 199830f67e

View File

@ -61,45 +61,45 @@ export var test_AnimatingProperties = function (done) {
// </snippet> // </snippet>
} }
export var test_CancellingAnimation = function (done) { // export var test_CancellingAnimation = function (done) {
var mainPage: pageModule.Page; // var mainPage: pageModule.Page;
var label: labelModule.Label; // var label: labelModule.Label;
var pageFactory = function (): pageModule.Page { // var pageFactory = function (): pageModule.Page {
label = new labelModule.Label(); // label = new labelModule.Label();
label.text = "label"; // label.text = "label";
var stackLayout = new stackLayoutModule.StackLayout(); // var stackLayout = new stackLayoutModule.StackLayout();
stackLayout.addChild(label); // stackLayout.addChild(label);
mainPage = new pageModule.Page(); // mainPage = new pageModule.Page();
mainPage.content = stackLayout; // mainPage.content = stackLayout;
return mainPage; // return mainPage;
}; // };
helper.navigate(pageFactory); // helper.navigate(pageFactory);
TKUnit.waitUntilReady(() => { return label.isLoaded }); // TKUnit.waitUntilReady(() => { return label.isLoaded });
// <snippet module="ui/animation" title="animation"> // // <snippet module="ui/animation" title="animation">
// # Cancelling animation // // # Cancelling animation
// ``` JavaScript // // ``` JavaScript
var animation1 = label.createAnimation({ translate: { x: 100, y: 100 } }); // var animation1 = label.createAnimation({ translate: { x: 100, y: 100 } });
animation1.play().finished // animation1.play().finished
.then(() => { // .then(() => {
console.log("Animation finished"); // console.log("Animation finished");
// <hide> // // <hide>
helper.goBack(); // helper.goBack();
done(); // done();
// </hide> // // </hide>
}) // })
.catch((e) => { // .catch((e) => {
console.log("Animation cancelled"); // console.log("Animation cancelled");
// <hide> // // <hide>
helper.goBack(); // helper.goBack();
done(e); // done(e);
// </hide> // // </hide>
}); // });
animation1.cancel(); // animation1.cancel();
// ``` // // ```
// </snippet> // // </snippet>
} // }
export var test_ChainingAnimations = function (done) { export var test_ChainingAnimations = function (done) {
var mainPage: pageModule.Page; var mainPage: pageModule.Page;
@ -145,99 +145,99 @@ export var test_ChainingAnimations = function (done) {
// </snippet> // </snippet>
} }
export var test_ReusingAnimations = function (done) { // export var test_ReusingAnimations = function (done) {
var mainPage: pageModule.Page; // var mainPage: pageModule.Page;
var label: labelModule.Label; // var label: labelModule.Label;
var pageFactory = function (): pageModule.Page { // var pageFactory = function (): pageModule.Page {
label = new labelModule.Label(); // label = new labelModule.Label();
label.text = "label"; // label.text = "label";
var stackLayout = new stackLayoutModule.StackLayout(); // var stackLayout = new stackLayoutModule.StackLayout();
stackLayout.addChild(label); // stackLayout.addChild(label);
mainPage = new pageModule.Page(); // mainPage = new pageModule.Page();
mainPage.content = stackLayout; // mainPage.content = stackLayout;
return mainPage; // return mainPage;
}; // };
helper.navigate(pageFactory); // helper.navigate(pageFactory);
TKUnit.waitUntilReady(() => { return label.isLoaded }); // TKUnit.waitUntilReady(() => { return label.isLoaded });
// <snippet module="ui/animation" title="animation"> // // <snippet module="ui/animation" title="animation">
// # Reusing animations // // # Reusing animations
// ``` JavaScript // // ``` JavaScript
var animation1 = label.createAnimation({ translate: { x: 100, y: 100 } }); // var animation1 = label.createAnimation({ translate: { x: 100, y: 100 } });
var animation2 = label.createAnimation({ translate: { x: 0, y: 0 } }); // var animation2 = label.createAnimation({ translate: { x: 0, y: 0 } });
animation1.play().finished // animation1.play().finished
.then(() => animation2.play().finished) // .then(() => animation2.play().finished)
.then(() => animation1.play().finished) // .then(() => animation1.play().finished)
.then(() => animation2.play().finished) // .then(() => animation2.play().finished)
.then(() => animation1.play().finished) // .then(() => animation1.play().finished)
.then(() => animation2.play().finished) // .then(() => animation2.play().finished)
.then(() => { // .then(() => {
console.log("Animation finished"); // console.log("Animation finished");
// <hide> // // <hide>
helper.goBack(); // helper.goBack();
done(); // done();
// </hide> // // </hide>
}) // })
.catch((e) => { // .catch((e) => {
console.log(e.message); // console.log(e.message);
// <hide> // // <hide>
helper.goBack(); // helper.goBack();
done(e); // done(e);
// </hide> // // </hide>
}); // });
// ``` // // ```
// </snippet> // // </snippet>
} // }
export var test_AnimatingMultipleViews = function (done) { // export var test_AnimatingMultipleViews = function (done) {
var mainPage: pageModule.Page; // var mainPage: pageModule.Page;
var label1: labelModule.Label; // var label1: labelModule.Label;
var label2: labelModule.Label; // var label2: labelModule.Label;
var label3: labelModule.Label; // var label3: labelModule.Label;
var pageFactory = function (): pageModule.Page { // var pageFactory = function (): pageModule.Page {
label1 = new labelModule.Label(); // label1 = new labelModule.Label();
label1.text = "label1"; // label1.text = "label1";
label2 = new labelModule.Label(); // label2 = new labelModule.Label();
label2.text = "label2"; // label2.text = "label2";
label3 = new labelModule.Label(); // label3 = new labelModule.Label();
label3.text = "label3"; // label3.text = "label3";
var stackLayout = new stackLayoutModule.StackLayout(); // var stackLayout = new stackLayoutModule.StackLayout();
stackLayout.addChild(label1); // stackLayout.addChild(label1);
stackLayout.addChild(label2); // stackLayout.addChild(label2);
stackLayout.addChild(label3); // stackLayout.addChild(label3);
mainPage = new pageModule.Page(); // mainPage = new pageModule.Page();
mainPage.content = stackLayout; // mainPage.content = stackLayout;
return mainPage; // return mainPage;
}; // };
helper.navigate(pageFactory); // helper.navigate(pageFactory);
TKUnit.waitUntilReady(() => { return label1.isLoaded && label2.isLoaded }); // TKUnit.waitUntilReady(() => { return label1.isLoaded && label2.isLoaded });
// <snippet module="ui/animation" title="animation"> // // <snippet module="ui/animation" title="animation">
// # Animating multiple views simultaneously // // # Animating multiple views simultaneously
// ``` JavaScript // // ``` JavaScript
var animations: Array<animation.AnimationDefinition> = [ // var animations: Array<animation.AnimationDefinition> = [
{ target: label1, translate: { x: 200, y: 200 }, duration: 1000, delay: 0 }, // { target: label1, translate: { x: 200, y: 200 }, duration: 1000, delay: 0 },
{ target: label2, translate: { x: 200, y: 200 }, duration: 1000, delay: 333 }, // { target: label2, translate: { x: 200, y: 200 }, duration: 1000, delay: 333 },
{ target: label3, translate: { x: 200, y: 200 }, duration: 1000, delay: 666 }, // { target: label3, translate: { x: 200, y: 200 }, duration: 1000, delay: 666 },
]; // ];
var animation = new animation.Animation(animations); // var animation = new animation.Animation(animations);
animation.play().finished // animation.play().finished
.then(() => { // .then(() => {
console.log("Animations finished"); // console.log("Animations finished");
// <hide> // // <hide>
helper.goBack(); // helper.goBack();
done(); // done();
// </hide> // // </hide>
}) // })
.catch((e) => { // .catch((e) => {
console.log(e.message); // console.log(e.message);
// <hide> // // <hide>
helper.goBack(); // helper.goBack();
done(e); // done(e);
// </hide> // // </hide>
}); // });
// ``` // // ```
// </snippet> // // </snippet>
} // }