https://github.com/shprink/ionic-native-transitions

https://www.npmjs.com/package/ionic-native-transitions

这个是ionic1的, 推荐使用ionic2开发, 或者ionic-native

Issue & solution

直接使用ionic的css动画, 页面数据较多的时候简直卡成翔了, 使用分页加载也没有太大的改善.

目前最佳方案是使用[]ionic-native-transitions插件](https://github.com/shprink/ionic-native-transitions)

install

# npm
npm install ionic-native-transitions --save # Using Ionic CLI
ionic cordova plugin add https://github.com/Telerik-Verified-Plugins/NativePageTransitions#0.6.5 # 报错Probably this is either a connection problem, or plugin spec is incorrect.
# 使用--nofetch来成功安装
cordova plugin add https://github.com/Telerik-Verified-Plugins/NativePageTransitions#0.6.5 --save --nofetch

Import

可以将ionic-native-transitions目录copy到www\lib下, 再在index.html中引入

<script src="lib/ionic-native-transitions/dist/ionic-native-transitions.min.js"></script>

config

angular.module('yourApp', [
'ionic-native-transitions'
]) .config(function($ionicNativeTransitionsProvider){
$ionicNativeTransitionsProvider.setDefaultOptions({
duration: 400, // in milliseconds (ms), default 400,
slowdownfactor: 4, // overlap views (higher number is more) or no overlap (1), default 4
iosdelay: -1, // ms to wait for the iOS webview to update before animation kicks in, default -1
androiddelay: -1, // same as above but for Android, default -1
winphonedelay: -1, // same as above but for Windows Phone, default -1,
fixedPixelsTop: 0, // the number of pixels of your fixed header, default 0 (iOS and Android)
fixedPixelsBottom: 0, // the number of pixels of your fixed footer (f.i. a tab bar), default 0 (iOS and Android)
triggerTransitionEvent: '$ionicView.afterEnter', // internal ionic-native-transitions option
backInOppositeDirection: false // Takes over default back transition and state back transition to use the opposite direction transition to go back
}); $ionicNativeTransitionsProvider.setDefaultOptions({
duration: 400, // in milliseconds (ms), default 400,
slowdownfactor: 4, // overlap views (higher number is more) or no overlap (1), default 4
iosdelay: -1, // ms to wait for the iOS webview to update before animation kicks in, default -1
androiddelay: -1, // same as above but for Android, default -1
winphonedelay: -1, // same as above but for Windows Phone, default -1,
fixedPixelsTop: 0, // the number of pixels of your fixed header, default 0 (iOS and Android)
fixedPixelsBottom: 0, // the number of pixels of your fixed footer (f.i. a tab bar), default 0 (iOS and Android)
triggerTransitionEvent: '$ionicView.afterEnter', // internal ionic-native-transitions option
backInOppositeDirection: false // Takes over default back transition and state back transition to use the opposite direction transition to go back
});
$ionicNativeTransitionsProvider.setDefaultTransition({
type: 'slide',
direction: 'left'
});
$ionicNativeTransitionsProvider.setDefaultBackTransition({
type: 'slide',
direction: 'right'
});
});

crosswork

如果你用了crosswork记得config.xml中添加:

Android

if you are using Crosswalk > 1.3 please add the following to your config.xml

<preference name="CrosswalkAnimatable" value="true" />

tab

我们不期望tab也出现这个切换效果, 禁用tab先的动画

.state('home', {
url: '/home',
nativeTransitions: null,
templateUrl: "templates/home.html"
})

ionic1页面切换动画卡顿优化的更多相关文章

  1. CSS3 动画卡顿性能优化解决方案--摘抄

    最近在开发小程序,与vue类似,它们都有生命周期这回事. onLoad 监听页面加载 onReady 监听页面初次渲染完成 onShow 监听页面显示 到底是什么意思? 所以这又触碰到了我的知识盲区, ...

  2. performance面板使用,以及解决动画卡顿

    https://googlechrome.github.io/devtools-samples/jank//    官方案例 https://juejin.im/post/5b65105f518825 ...

  3. (原)android中的动画(三)之动画监听&页面切换动画

    1.动画也可以设置监听事件,例如在动画结束时需要执行某操作 把要执行的代码写在onAnimationEnd()回调方法中即可: anim.setAnimationListener(new Animat ...

  4. Chrome 下动画卡顿问题的另一种可能

    [现象] 动画出现了明显的卡顿,且仅仅出现在 chrome 中. [原因排查] 一开始使用了css动画的时候已经出现了卡顿.找到如下的文章:CSS3 动画卡顿解决方案.深入浏览器理解CSS anima ...

  5. iOS页面切换动画实现方式。

    iOS页面切换动画实现方式. 1.使用UIView animateWithDuration:animations:completion方法 Java代码 [UIView animateWithDura ...

  6. javascript 手势(swipeLeft,swipeRight)滑动中使用css3动画卡顿,开启硬件加速

    今天,在做一个移动端项目,遇到了css3动画卡顿的现象. 例图: 在手势滑动中(swipeLeft,swipeRight)遇到了动画卡顿的现象,最后使用了css3动画-webkit-transform ...

  7. QtQuick多页面切换、多页面切换动画、多个qml文件数据交互

    一.QtQuick多页面切换方法 (1)“隐藏法” 前一个视图visible设为false或者透明度opacity设为0,相当于“隐藏”了,实际还存在: 要显示的视图visible设为true或者透明 ...

  8. android中app卡顿优化问题

     所谓app卡顿原因就是在运行时出现了丢帧,还可能是UI线程被阻塞.首先来一下丢帧现象,android每16ms会对界面进行一次渲染,如果app的绘制.计算等超过了16ms那么只能等下一个16ms才能 ...

  9. Android性能优化----卡顿优化

    前言 无论是启动,内存,布局等等这些优化,最终的目的就是为了应用不卡顿.应用的体验性好坏,最直观的表现就是应用的流畅程度,用户不知道什么启动优化,内存不足,等等,应用卡顿,那么这个应用就不行,被卸载的 ...

随机推荐

  1. for循环的简介及break和continue的区别

    break和continue都是用来控制循环结构的,主要是停止循环. 1.break 有时候我们想在某种条件出现的时候终止循环而不是等到循环条件为false才终止. 这是我们可以使用break来完成. ...

  2. 爬虫3 requests基础

    import requests # get实例 # res = requests.get('http://httpbin.org/get') # # res.encoding='utf-8' # pr ...

  3. Bi-shoe and Phi-shoe (欧拉函数)

    题目描述: 题目大意:一个竹竿长度为p,它的score值就是比p长度小且与且与p互质的数字总数,比如9有1,2,4,5,7,8这六个数那它的score就是6.给你T组数据,每组n个学生,每个学生都有一 ...

  4. 开启vue源码的解析攻略---认识flow

    javascript 是动态类型的代码,有很多的写法很不容易报错,想引入静态类型检查的flow,之前做项目的时候用的typascript的,看的大概的写法和 typescript 类似,因为规范避免了 ...

  5. POJ 3281 Dining (拆点)【最大流】

    <题目链接> 题目大意: 有N头牛,F种食物,D种饮料,每一头牛都有自己喜欢的食物和饮料,且每一种食物和饮料都只有一份,让你分配这些食物和饮料,问最多能使多少头牛同时获得自己喜欢的食物和饮 ...

  6. Pandas学习1 --- 数据载入

    import numpy as np import pandas as pd 数据加载 首先,我们需要将收集的数据加载到内存中,才能进行进一步的操作.pandas提供了非常多的读取数据的函数,分别应用 ...

  7. burpsuite https证书设置

    java更新.burpsuite换来换去,chrome的证书似乎失效了.重新来一边证书导入,有一些导入方法确实坑. 尝试了直接导入到受信任的机构是无效的. 两年前就因为导入到受信任的机构,又找不到导入 ...

  8. springboot整合springmvc上传文件

    1.pom.xml <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www ...

  9. Node.js API快速入门

    Node.js API 快速入门 一.事件EventEmitter const EventEmitter = require('events'); class MyEmitter extends Ev ...

  10. getchar getche getch

    转至:https://blog.csdn.net/hairetz/article/details/4161954 (1) getch()和getche()函数     这两个函数都是从键盘上读入一个字 ...