mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
Add animations test page to ui-tests-app
https://github.com/NativeScript/NativeScript/issues/1218
This commit is contained in:
23
apps/ui-tests-app/animations/background.ts
Normal file
23
apps/ui-tests-app/animations/background.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import observable = require("data/observable");
|
||||
import pages = require("ui/page");
|
||||
import viewModule = require("ui/core/view");
|
||||
import color = require("color");
|
||||
|
||||
var view: viewModule.View;
|
||||
|
||||
export function pageLoaded(args: observable.EventData) {
|
||||
var page = <pages.Page>args.object;
|
||||
view = page.getViewById<viewModule.View>("view");
|
||||
}
|
||||
|
||||
export function onAnimate(args: observable.EventData) {
|
||||
view.backgroundColor = new color.Color("Green");
|
||||
view.animate({
|
||||
backgroundColor: new color.Color("Blue"),
|
||||
duration: 2500
|
||||
});
|
||||
}
|
||||
|
||||
export function onReset(args: observable.EventData) {
|
||||
view.backgroundColor = new color.Color("White");
|
||||
}
|
||||
9
apps/ui-tests-app/animations/background.xml
Normal file
9
apps/ui-tests-app/animations/background.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<Page loaded="pageLoaded">
|
||||
<StackLayout>
|
||||
<Button text="Animate" tap="onAnimate"/>
|
||||
<Button text="Reset" tap="onReset"/>
|
||||
<AbsoluteLayout width="300" height="300" clipToBounds="true" backgroundColor="LightGray">
|
||||
<Button id="view" text="{N}" width="100" height="100" left="100" top="100" style.textAlignment="center" backgroundColor="White" style.fontSize="30"/>
|
||||
</AbsoluteLayout>
|
||||
</StackLayout>
|
||||
</Page>
|
||||
Reference in New Issue
Block a user