mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-03-17 17:21:08 +08:00
144 lines
3.4 KiB
TypeScript
144 lines
3.4 KiB
TypeScript
import { Injectable } from '@angular/core';
|
|
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
|
|
|
|
export interface NativeTransitionOptions {
|
|
direction?: string;
|
|
duration?: number;
|
|
slowdownfactor?: number;
|
|
slidePixels?: number;
|
|
iosdelay?: number;
|
|
androiddelay?: number;
|
|
winphonedelay?: number;
|
|
fixedPixelsTop?: number;
|
|
fixedPixelsBottom?: number;
|
|
action?: string;
|
|
origin?: string;
|
|
href?: string;
|
|
}
|
|
|
|
/**
|
|
* @name Native Page Transitions
|
|
* @description
|
|
* The Native Page Transitions plugin uses native hardware acceleration to animate your transitions between views. You have complete control over the type of transition, the duration, and direction.
|
|
*
|
|
* @usage
|
|
* ```typescript
|
|
* import { NativePageTransitions, NativeTransitionOptions } from '@ionic-native/native-page-transitions/ngx';
|
|
*
|
|
* constructor(private nativePageTransitions: NativePageTransitions) { }
|
|
*
|
|
* ...
|
|
*
|
|
*
|
|
* // example of adding a transition when a page/modal closes
|
|
* ionViewWillLeave() {
|
|
*
|
|
* let options: NativeTransitionOptions = {
|
|
* direction: 'up',
|
|
* duration: 500,
|
|
* slowdownfactor: 3,
|
|
* slidePixels: 20,
|
|
* iosdelay: 100,
|
|
* androiddelay: 150,
|
|
* fixedPixelsTop: 0,
|
|
* fixedPixelsBottom: 60
|
|
* }
|
|
*
|
|
* this.nativePageTransitions.slide(options)
|
|
* .then(onSuccess)
|
|
* .catch(onError);
|
|
*
|
|
* }
|
|
*
|
|
*
|
|
* // example of adding a transition when pushing a new page
|
|
* openPage(page: any) {
|
|
*
|
|
* this.nativePageTransitions.slide(options);
|
|
* this.navCtrl.push(page);
|
|
*
|
|
* }
|
|
*
|
|
* ```
|
|
*/
|
|
@Plugin({
|
|
pluginName: 'NativePageTransitions',
|
|
plugin: 'com.telerik.plugins.nativepagetransitions',
|
|
pluginRef: 'plugins.nativepagetransitions',
|
|
repo: 'https://github.com/Telerik-Verified-Plugins/NativePageTransitions',
|
|
platforms: ['Android', 'iOS', 'Windows Phone 8']
|
|
})
|
|
@Injectable()
|
|
export class NativePageTransitions extends IonicNativePlugin {
|
|
/**
|
|
* Perform a slide animation
|
|
* @param options {NativeTransitionOptions} Options for the transition
|
|
* @returns {Promise<any>}
|
|
*/
|
|
@Cordova()
|
|
slide(options: NativeTransitionOptions): Promise<any> {
|
|
return;
|
|
}
|
|
|
|
/**
|
|
* Perform a flip animation
|
|
* @param options {NativeTransitionOptions} Options for the transition
|
|
* @returns {Promise<any>}
|
|
*/
|
|
@Cordova()
|
|
flip(options: NativeTransitionOptions): Promise<any> {
|
|
return;
|
|
}
|
|
|
|
/**
|
|
* Perform a fade animation
|
|
* @param options {NativeTransitionOptions} Options for the transition
|
|
* @returns {Promise<any>}
|
|
*/
|
|
@Cordova({ platforms: ['iOS', 'Android'] })
|
|
fade(options: NativeTransitionOptions): Promise<any> {
|
|
return;
|
|
}
|
|
|
|
|
|
/**
|
|
* Perform a slide animation
|
|
* @param options {NativeTransitionOptions} Options for the transition
|
|
* @returns {Promise<any>}
|
|
*/
|
|
@Cordova({ platforms: ['iOS', 'Android'] })
|
|
drawer(options: NativeTransitionOptions): Promise<any> {
|
|
return;
|
|
}
|
|
|
|
|
|
/**
|
|
* Perform a slide animation
|
|
* @param options {NativeTransitionOptions} Options for the transition
|
|
* @returns {Promise<any>}
|
|
*/
|
|
@Cordova({ platforms: ['iOS'] })
|
|
curl(options: NativeTransitionOptions): Promise<any> {
|
|
return;
|
|
}
|
|
|
|
/**
|
|
* Execute pending transition
|
|
* @returns {Promise<any>}
|
|
*/
|
|
@Cordova()
|
|
executePendingTransition(): Promise<any> {
|
|
return;
|
|
}
|
|
|
|
/**
|
|
* Cancel pending transition
|
|
* @returns {Promise<any>}
|
|
*/
|
|
@Cordova()
|
|
cancelPendingTransition(): Promise<any> {
|
|
return;
|
|
}
|
|
|
|
}
|