diff --git a/js/animation/animation.js b/js/animation/animation.js index 476cf8650a..b8a3462868 100644 --- a/js/animation/animation.js +++ b/js/animation/animation.js @@ -80,6 +80,8 @@ delay: 0, repeat: -1, + step: function(percent) {}, + stop: function() { }, @@ -100,8 +102,10 @@ // Get back a timing function for the given duration (used for precision) tf = tf(this.duration); - return this._run(function(percent, now, virtual) { - self.el[0].style[ionic.CSS.TRANSFORM] = 'translate3d(' + (percent * 400) + 'px, 0,0)'; + return this._run(function(percent, now, render) { + if(render) { + self.step(percent); + } }, function() { return true; }, function(droppedFrames, finishedAnimation) { diff --git a/test/html/animation.html b/test/html/animation.html index e3e681672a..7f5ba7acd2 100644 --- a/test/html/animation.html +++ b/test/html/animation.html @@ -28,6 +28,22 @@
+ + + +
@@ -42,17 +58,26 @@ 'ease-out', 'ease-in-out' ]; + $scope.anim = { + duration: 500, + delay: 0, + repeat: -1, + autoReverse: false + } var el = angular.element(document.querySelector('.box')); $scope.do = function(fn) { - var fadeIn = $ionicAnimation({ + var fadeIn = $ionicAnimation(angular.extend({ el: el, name: 'fadeIn', duration: 500, delay: 0, autoReverse: false, repeat: -1, - curve: fn - }); + curve: fn, + step: function(v) { + el[0].style[ionic.CSS.TRANSFORM] = 'translate3d(' + (v * 400) + 'px, 0,0)'; + } + }, $scope.anim)); fadeIn.start(); }