mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 03:31:45 +08:00
21 lines
726 B
TypeScript
21 lines
726 B
TypeScript
import { EventData, Page } from "tns-core-modules/ui/page";
|
|
import { View } from "tns-core-modules/ui/core/view";
|
|
import { KeyframeAnimation, KeyframeAnimationInfo } from "tns-core-modules/ui/animation/keyframe-animation";
|
|
|
|
let view: View;
|
|
let animationInfo: KeyframeAnimationInfo;
|
|
|
|
export function pageLoaded(args: EventData) {
|
|
const page = <Page>args.object;
|
|
view = page.getViewById<View>("view");
|
|
animationInfo = page.getKeyframeAnimationWithName("bounce");
|
|
animationInfo.duration = 2000;
|
|
}
|
|
|
|
export function onAnimate(args: EventData) {
|
|
let animation = KeyframeAnimation.keyframeAnimationFromInfo(animationInfo);
|
|
animation.play(view).then(() => {
|
|
console.log("Played with code!");
|
|
});
|
|
}
|