mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
Support slowing animations (for debugging)
This commit is contained in:
25
js/angular/service/animation.js
vendored
25
js/angular/service/animation.js
vendored
@@ -1,3 +1,4 @@
|
||||
|
||||
/**
|
||||
* @ngdoc service
|
||||
* @name $ionicAnimation
|
||||
@@ -45,14 +46,16 @@
|
||||
*
|
||||
*/
|
||||
IonicModule
|
||||
.factory('$ionicAnimation', [
|
||||
'$rootScope',
|
||||
'$document',
|
||||
'$compile',
|
||||
'$timeout',
|
||||
'$interval',
|
||||
function($rootScope, $document, $compile, $timeout, $interval) {
|
||||
return function(opts) {
|
||||
return ionic.Animation.create(opts);
|
||||
}
|
||||
}]);
|
||||
.provider('$ionicAnimation', function() {
|
||||
var useSlowAnimations = false;
|
||||
this.setSlowAnimations = function(isSlow) {
|
||||
useSlowAnimations = isSlow;
|
||||
};
|
||||
|
||||
this.$get = [function() {
|
||||
return function(opts) {
|
||||
opts.useSlowAnimations = useSlowAnimations;
|
||||
return ionic.Animation.create(opts);
|
||||
}
|
||||
}]
|
||||
});
|
||||
|
||||
@@ -71,6 +71,12 @@
|
||||
*/
|
||||
ionic.Animation.Animation = function(opts) {
|
||||
ionic.extend(this, opts);
|
||||
|
||||
if(opts.useSlowAnimations) {
|
||||
console.warn('Running animation', opts.name, 'with SLOW animations (duration and delay increased by 3x)');
|
||||
this.delay *= 3;
|
||||
this.duration *= 3;
|
||||
}
|
||||
};
|
||||
|
||||
ionic.Animation.Animation.prototype = {
|
||||
|
||||
@@ -50,6 +50,9 @@
|
||||
|
||||
<script>
|
||||
angular.module('myApp', ['ionic'])
|
||||
.config(['$ionicAnimationProvider', function($ionicAnimationProvider) {
|
||||
//$ionicAnimationProvider.setSlowAnimations(true);
|
||||
}])
|
||||
.controller('MyCtrl', function($scope, $ionicAnimation) {
|
||||
$scope.fns = [
|
||||
'linear',
|
||||
|
||||
Reference in New Issue
Block a user