Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed half pixel bug for idevices. Fixed bad updates idevices

  • Loading branch information...
commit 0bb375d528af45582091df7eac206eb454ba76c1 1 parent 5a087c7
Jacko Hoogeveen authored
Showing with 25 additions and 23 deletions.
  1. +21 −23 source/jarallax.js
  2. +4 −0 source/jarallax_animation.js
View
44 source/jarallax.js
@@ -11,6 +11,7 @@ var Jarallax = function (controller) {
this.animations = [];
this.defaultValues = [];
this.progress = 0.0;
+ this.prev_progress = 0.0;
this.controllers = [];
this.maxProgress = 1;
this.timer = undefined;
@@ -57,34 +58,31 @@ Jarallax.prototype.setProgress = function (progress, isWeak) {
} else if (progress < 0) {
progress = 0;
}
+ this.prev_progress = this.progress;
this.progress = progress;
-
-
-
- if (this.allowWeakProgress || !weak) {
- this.previousTime = new Date();
-
- this.currentTime = new Date();
+ if(this.prev_progress !== progress) {
+ if (this.allowWeakProgress || !weak) {
+ this.previousTime = new Date();
+ this.currentTime = new Date();
- var weak = isWeak || false;
-
- for (var defaultValue in this.defaultValues) {
- this.defaultValues[defaultValue].activate(this.progress);
- }
-
- for (var animation in this.animations) {
- this.animations[animation].activate(this.progress);
- }
+ var weak = isWeak || false;
- for (var controller in this.controllers) {
- this.controllers[controller].update(this.progress);
+ for (var defaultValue in this.defaultValues) {
+ this.defaultValues[defaultValue].activate(this.progress);
+ }
+
+ for (var animation in this.animations) {
+ this.animations[animation].activate(this.progress);
+ }
+
+ for (var controller in this.controllers) {
+ this.controllers[controller].update(this.progress);
+ }
+
+ this.currentTime = new Date();
+ this.stepSize = Math.max(this.currentTime - this.previousTime, this.stepSize);
}
-
- this.currentTime = new Date();
- this.stepSize = Math.max(this.currentTime - this.previousTime, this.stepSize);
}
-
-
};
Jarallax.prototype.clearAnimations = function() {
View
4 source/jarallax_animation.js
@@ -53,6 +53,10 @@ JarallaxAnimation.prototype.activate = function (progress) {
var result = Jarallax.EASING[style.easing](currentTime,
startValue , changeInValue, duration, style.power);
+ if(units == 'px'){
+ result = parseInt(result, 10);
+ }
+
if(units !== '.'){
result+= units;
}
Please sign in to comment.
Something went wrong with that request. Please try again.