From 427c7c5bb019b5553469b9703fff563a19f7b9e8 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Wed, 26 Jan 2022 18:06:56 +0100 Subject: [PATCH] wip #5060 @0.25 --- js/libs/fluidbook/fluidbook.3dflip.js | 78 +++++++++++---------------- 1 file changed, 30 insertions(+), 48 deletions(-) diff --git a/js/libs/fluidbook/fluidbook.3dflip.js b/js/libs/fluidbook/fluidbook.3dflip.js index 31c54ae1..9fa6c6cf 100644 --- a/js/libs/fluidbook/fluidbook.3dflip.js +++ b/js/libs/fluidbook/fluidbook.3dflip.js @@ -80,7 +80,8 @@ Fluidbook3DFlip.prototype = { success: function (data) { $this.benchmark = parseInt(data); cb(); - }, error: function () { + }, + error: function () { cb(); } }); @@ -102,12 +103,14 @@ Fluidbook3DFlip.prototype = { this.container = $(this.jcontainer).get(0); - var mode; - if ($_GET['performance'] == null) { - mode = 'performancesTest'; - } else { - var map = {1: 'highPerf', 2: 'lowPerf', 3: 'veryLowPerf'}; - mode = map[$_GET['performance']]; + var mode = this.fluidbook.settings.performance3DMode; + if (mode===undefined || mode===null || mode === 'auto') { + if ($_GET['performance'] == null) { + mode = 'performancesTest'; + } else { + var map = {1: 'highPerf', 2: 'lowPerf', 3: 'veryLowPerf'}; + mode = map[$_GET['performance']]; + } } this.init3D(mode); @@ -291,10 +294,7 @@ Fluidbook3DFlip.prototype = { if (this.enableShadow) { geometry = new THREE.PlaneGeometry(this.fluidbook.settings.width * this.geometryScale * 2, this.fluidbook.settings.height * this.geometryScale, 1, 1, true); var shadowTexture = new THREE.ShadowMaterial({ - color: 0x000000, - side: THREE.FrontSide, - overdraw: 0.5, - opacity: .1 + color: 0x000000, side: THREE.FrontSide, overdraw: 0.5, opacity: .1 }); this.shadowPlane = new THREE.Mesh(geometry, [shadowTexture]); this.shadowPlane.receiveShadow = true; @@ -318,15 +318,9 @@ Fluidbook3DFlip.prototype = { if (this.enableLight) { meshSettings.roughness = roughness; - this.textures = [ - new THREE.MeshStandardMaterial(meshSettings), - new THREE.MeshStandardMaterial(meshSettings), - ]; + this.textures = [new THREE.MeshStandardMaterial(meshSettings), new THREE.MeshStandardMaterial(meshSettings),]; } else { - this.textures = [ - new THREE.MeshBasicMaterial(meshSettings), - new THREE.MeshBasicMaterial(meshSettings), - ]; + this.textures = [new THREE.MeshBasicMaterial(meshSettings), new THREE.MeshBasicMaterial(meshSettings),]; } geometry.translate(this.fluidbook.settings.width * this.geometryScale * 0.5, 0, 0); @@ -425,13 +419,11 @@ Fluidbook3DFlip.prototype = { this.tlright = new TimelineMax(); this.tlright.add(TweenMax.fromTo(this.bend, .5, {force: 0}, { - force: force * -1, - ease: easeIn + force: force * -1, ease: easeIn })); this.tlright.add(TweenMax.fromTo(this.bend, .5, {force: force * -1}, {force: 0, ease: easeOut})); this.tlright.add(TweenMax.fromTo(this, 1, {_pageRotation: -0}, { - _pageRotation: -180, - ease: easeIn + _pageRotation: -180, ease: easeIn }), 0); this.tlright.add(TweenMax.fromTo(this, 1, {_gapOffset: -0.5}, {_gapOffset: 1.2, ease: noease}), 0); this.tlright.pause(); @@ -439,13 +431,11 @@ Fluidbook3DFlip.prototype = { this.tlleft = new TimelineMax(); this.tlleft.add(TweenMax.fromTo(this.bend, .5, {force: 0}, { - force: force, - ease: easeIn + force: force, ease: easeIn })); this.tlleft.add(TweenMax.fromTo(this.bend, .5, {force: force}, {force: 0, ease: easeOut})); this.tlleft.add(TweenMax.fromTo(this, 1, {_pageRotation: -180}, { - _pageRotation: -0, - ease: easeIn + _pageRotation: -0, ease: easeIn }), 0); this.tlleft.add(TweenMax.fromTo(this, 1, {_gapOffset: 1.2}, {_gapOffset: -0.5, ease: easeOut}), 0); this.tlleft.pause(); @@ -629,27 +619,20 @@ Fluidbook3DFlip.prototype = { delay = this.fluidbook.support.iOS ? 0.15 : 0.06; } - TweenMax.fromTo(this, this.animationTime * timeScale, - {progressAnimation: 0,}, - { - progressAnimation: 1, - ease: Power0.easeIn, - delay: delay, - onStart: function () { - if ($this.performancesTestRunning) { - $this.performancesStartTime = new Date(); - } - }, - onComplete: function () { - this.tlname = ''; - callback(); - setTimeout(function () { - $this.turnRunning = false; - }, 5); - //$this._callbackAfterNextRender = callback; + TweenMax.fromTo(this, this.animationTime * timeScale, {progressAnimation: 0,}, { + progressAnimation: 1, ease: Power0.easeIn, delay: delay, onStart: function () { + if ($this.performancesTestRunning) { + $this.performancesStartTime = new Date(); } + }, onComplete: function () { + this.tlname = ''; + callback(); + setTimeout(function () { + $this.turnRunning = false; + }, 5); + //$this._callbackAfterNextRender = callback; } - ); + }); }, animate: function (next) { @@ -820,8 +803,7 @@ Fluidbook3DFlip.prototype = { vector.y = -(vector.y * heightHalf) + heightHalf; return { - x: vector.x, - y: vector.y + x: vector.x, y: vector.y }; }, -- 2.39.5