]> _ Git - fluidbook-html5.git/commitdiff
wip #809 @3
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 31 Aug 2018 16:53:07 +0000 (18:53 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 31 Aug 2018 16:53:07 +0000 (18:53 +0200)
js/libs/fluidbook/fluidbook.3dflip.js

index cd85a6aea83b5d01f8add1fbfe08c62dc2901c6e..9fe4b2dbfc1ea7cdeebeab0e23a342307bb8323a 100644 (file)
@@ -68,6 +68,10 @@ Fluidbook3DFlip.prototype = {
             this.disposeHierarchy(this.scene, this.disposeNode);
         }
 
+        if (performanceMode == 'disable') {
+            return;
+        }
+
         if (performanceMode === undefined || performanceMode === 'auto' || performanceMode === 'performancesTest') {
             this.veryLowPerf = this.fluidbook.support.IE > 0;
             this.lowPerf = !Modernizr.webgl || this.veryLowPerf || this.fluidbook.support.edge || this.fluidbook.support.android || this.fluidbook.support.iOS;
@@ -291,20 +295,22 @@ Fluidbook3DFlip.prototype = {
             $this.performancesStartTime = new Date();
             $this.playTurn(1, function () {
                 $this.performancesEndTime = new Date();
-                $this.adjustPerformancesSettings();
-                callback();
+                $this.adjustPerformancesSettings(callback);
             });
         });
     },
 
-    adjustPerformancesSettings: function () {
+    adjustPerformancesSettings: function (callback) {
+        var $this = this;
         var newMode;
         if (this.veryLowPerf) {
             newMode = 'veryLowPerf';
         } else {
             var res = this.getPerformancesTestResult();
             if (!this.lowPerf) {
-                if (res < 10) {
+                if (res < 5) {
+                    newMode = 'disable';
+                } else if (res < 10) {
                     newMode = 'veryLowPerf';
                 } else if (res < 30) {
                     newMode = 'lowPerf';
@@ -312,15 +318,28 @@ Fluidbook3DFlip.prototype = {
                     newMode = 'highPerf';
                 }
             } else {
-                if (res < 30) {
+                if (res < 10) {
+                    newMode = 'disable';
+                } else if (res < 30) {
                     newMode = 'veryLowPerf';
                 } else {
                     newMode = 'lowPerf';
                 }
             }
         }
-        this.init3D(newMode);
-        console.log('Performances test ok : ' + res);
+
+        if (newMode !== 'disable') {
+            this.init3D(newMode);
+            this.prepareTurn({flip: [1, 2]}, function () {
+                $this.playTurn(1, function () {
+                    callback();
+                });
+            });
+            console.log('Performances test ok : ' + res);
+        } else {
+            this.fluidbook.support.transitions3dacc = false;
+            callback();
+        }
     },
 
     texturesLoaded: function (t1, t2, callback) {
@@ -361,15 +380,20 @@ Fluidbook3DFlip.prototype = {
 
         var $this = this;
 
+        this.turnRunning = true;
+
+        this.tlname = dir === 1 ? 'right' : 'left';
+
         this.tlleft.kill();
         this.tlright.kill();
 
-        this.tlname = dir === 1 ? 'right' : 'left';
         this.progressAnimation(0);
         this.animate(false);
-        this.turnRunning = true;
 
-        TweenMax.to(this, this.animationTime,
+        TweenMax.fromTo(this, this.animationTime,
+            {
+                progressAnimation: 0,
+            },
             {
                 progressAnimation: 1,
                 ease: Power0.easeIn,