From 09f78bc45f7bff3c4c5afbe8280165ef82b9e0be Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Fri, 31 Aug 2018 18:53:07 +0200 Subject: [PATCH] wip #809 @3 --- js/libs/fluidbook/fluidbook.3dflip.js | 44 +++++++++++++++++++++------ 1 file changed, 34 insertions(+), 10 deletions(-) diff --git a/js/libs/fluidbook/fluidbook.3dflip.js b/js/libs/fluidbook/fluidbook.3dflip.js index cd85a6ae..9fe4b2db 100644 --- a/js/libs/fluidbook/fluidbook.3dflip.js +++ b/js/libs/fluidbook/fluidbook.3dflip.js @@ -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, -- 2.39.5