forked from NativeScript/nativescript-angular
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathanimation-driver.ts
More file actions
29 lines (25 loc) · 1.02 KB
/
animation-driver.ts
File metadata and controls
29 lines (25 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import { AnimationPlayer } from "@angular/core";
import { AnimationStyles, AnimationKeyframe } from "./private_import_core";
import { NativeScriptAnimationPlayer } from "./animation-player";
import { View } from "ui/core/view";
import { getPropertyByCssName } from "ui/styling/style-property";
export abstract class AnimationDriver {
abstract animate(
element: any, startingStyles: AnimationStyles, keyframes: AnimationKeyframe[],
duration: number, delay: number, easing: string): AnimationPlayer;
}
export class NativeScriptAnimationDriver implements AnimationDriver {
computeStyle(element: any, prop: string): string {
return (<View>element).style._getValue(getPropertyByCssName(prop));
}
animate(
element: any,
_startingStyles: AnimationStyles,
keyframes: AnimationKeyframe[],
duration: number,
delay: number,
easing: string
): AnimationPlayer {
return new NativeScriptAnimationPlayer(element, keyframes, duration, delay, easing);
}
}