]> _ Git - fluidbook-html5.git/commitdiff
wip #5060 @0.25
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 26 Jan 2022 17:06:56 +0000 (18:06 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 26 Jan 2022 17:06:56 +0000 (18:06 +0100)
js/libs/fluidbook/fluidbook.3dflip.js

index 31c54ae18b01540ccd353d408281d48a40907b51..9fa6c6cf5fe9afd0713b688b1b366c6f48446c82 100644 (file)
@@ -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
         };
     },