perf(animations): throttle calls to requestAnimationFrame

Closes #582
This commit is contained in:
Andy Joslin
2014-02-17 17:25:31 -05:00
parent 97f4f6eace
commit d056ad1fef
12 changed files with 193 additions and 195 deletions

View File

@@ -110,14 +110,12 @@ angular.module('ionic.ui.sideMenu', ['ionic.service.gesture', 'ionic.service.vie
getTranslateX: function() {
return $scope.sideMenuContentTranslateX || 0;
},
setTranslateX: function(amount) {
window.rAF(function() {
$element[0].style.webkitTransform = 'translate3d(' + amount + 'px, 0, 0)';
$timeout(function() {
$scope.sideMenuContentTranslateX = amount;
});
setTranslateX: ionic.animationFrameThrottle(function(amount) {
$element[0].style.webkitTransform = 'translate3d(' + amount + 'px, 0, 0)';
$timeout(function() {
$scope.sideMenuContentTranslateX = amount;
});
},
}),
enableAnimation: function() {
//this.el.classList.add(this.animateClass);
$scope.animationEnabled = true;